diff options
author | will <will@FreeBSD.org> | 2001-08-30 07:16:13 +0800 |
---|---|---|
committer | will <will@FreeBSD.org> | 2001-08-30 07:16:13 +0800 |
commit | 77b523edaad2bd6c6d6e085ca71d98eb7536f554 (patch) | |
tree | 7c2211beed17dcba5d63f24a01d3d216543cc598 /x11/kdelibs4 | |
parent | 61dd07468b73dea50627420083b95a4f05d5692d (diff) | |
download | freebsd-ports-gnome-77b523edaad2bd6c6d6e085ca71d98eb7536f554.tar.gz freebsd-ports-gnome-77b523edaad2bd6c6d6e085ca71d98eb7536f554.tar.zst freebsd-ports-gnome-77b523edaad2bd6c6d6e085ca71d98eb7536f554.zip |
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
Diffstat (limited to 'x11/kdelibs4')
-rw-r--r-- | x11/kdelibs4/Makefile | 2 | ||||
-rw-r--r-- | x11/kdelibs4/files/patch-kdoctools::xml2man.cpp | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/x11/kdelibs4/Makefile b/x11/kdelibs4/Makefile index 540b32e9e15d..5765e85fda27 100644 --- a/x11/kdelibs4/Makefile +++ b/x11/kdelibs4/Makefile @@ -7,7 +7,7 @@ PORTNAME= kdelibs PORTVERSION= 2.2 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= x11 kde MASTER_SITES= ${MASTER_SITE_KDE} MASTER_SITE_SUBDIR= stable/${PORTVERSION}/src diff --git a/x11/kdelibs4/files/patch-kdoctools::xml2man.cpp b/x11/kdelibs4/files/patch-kdoctools::xml2man.cpp new file mode 100644 index 000000000000..fb020b58532c --- /dev/null +++ b/x11/kdelibs4/files/patch-kdoctools::xml2man.cpp @@ -0,0 +1,13 @@ +--- kdoctools/xml2man.cpp Sat Jul 28 23:55:05 2001 ++++ kdoctools/xml2man.cpp.new Wed Aug 29 18:10:54 2001 +@@ -63,9 +63,7 @@ + QString pat = args->arg( 0 ); + QFile xmlFile( pat ); + xmlFile.open(IO_ReadOnly); +- QCString contents; +- contents.assign(xmlFile.readAll()); +- contents.truncate(xmlFile.size()); ++ QCString contents(xmlFile.radAll(), xmlFile.size() + 1); + xmlFile.close(); + + contents.replace( QRegExp( "<!--[^-]*-->" ), "" ); |