From owner-cvs-all Wed Aug 29 16:16:19 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E52A337B405; Wed, 29 Aug 2001 16:16:13 -0700 (PDT) (envelope-from will@FreeBSD.org) Received: (from will@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f7TNGDj21514; Wed, 29 Aug 2001 16:16:13 -0700 (PDT) (envelope-from will) Message-Id: <200108292316.f7TNGDj21514@freefall.freebsd.org> From: Will Andrews Date: Wed, 29 Aug 2001 16:16:13 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: ports/x11/kdelibs2 Makefile ports/x11/kdelibs2/files patch-kdoctools::xml2man.cpp X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG will 2001/08/29 16:16:13 PDT Modified files: x11/kdelibs2 Makefile Added files: x11/kdelibs2/files patch-kdoctools::xml2man.cpp Log: Add patch for kdoctools/xml2man.cpp, similar to xslt.cpp patch. Bump PORTREVISION just in case this is needed. From Mikhail Teterin: > Well, for the same reason the xslt.cpp sometimes works -- in fact, it > worked for everyone, until someone tried it on current. > > In essence, the code reads the whole file into a buffer. It then tries > to turn that buffer into one of qt's string-objects (QCString). The > class' constructor they chose assumes, it is passed a valid (aka > \0-terminated) string and goes through the buffer looking for the first > 0-byte. The file itself does not contain any, so it happily wonders > behind the real end of the buffer until it either finds a stray 0-byte, > or seg-faults, trying to read a wrong page. > > Apparently, more often than not, some stray 0-byte is there -- no > surprise. But it will usually create a string that's longer than the > file size -- unless the 0-byte happens to be right there at the end of > the buffer. Apparently, the lamer, who wrote it, noticed something > strange, so he/she explicitly truncates the created QCString object to > the known size of the file after instantiation: > > contents.truncate(xmlFile.size()) > > My patch modifies the code to use the correct QCString constructor -- > the one, that accepts the maximum size of the string. This does the > right thing -- once it reaches the end of the buffer, it stops, > allocates the private storage (I hate C++ for all this buffer copying), > appends the 0-byte and creates the object of the expected size. No > truncation is needed.... Thanks to Mikhail for his debugging on this problem; this patch further removes the hazard of meinproc coredumps. Submitted by: mi Revision Changes Path 1.86 +1 -1 ports/x11/kdelibs2/Makefile To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message