Share

RapidXml

Tracker: Patches

5 Rapid XML 1.12 doesn't handle zero-length strings correctly - ID: 2656216
Last Update: Comment added ( nobody )

Rapid XML 1.12 interprets a zero, when specified as a string's length, as
indicating that the string is a C-string & its length should be calculated
appropriately.
This makes it difficult to add variable length data where it may have zero
length, but isn't necessarily a C-string. This may have also introduced
hidden bugs into users code. Zero is a valid length for data & should be
interpreted literally.

The attached patch defines a new constant `auto_size` to use instead of `0`
and modifies code appropriately. Note: The change was sufficient for my
usage. It probably requires some further work to update every occurrence.


Nobody/Anonymous ( nobody ) - 2009-03-03 03:20

5

Open

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )




Date: 2009-08-17 19:05
Sender: nobody

This is a significant problem. Take, for instance, a routine which is
designed to copy an arbitrary XML tree to a different document. To support
both destructively-parsed and non-destructively-parsed trees, and for
efficiency, such a routine will need to call allocate_string() with a
length parameter. But if the source tree contains strings with zero length
that are not NULL terminated, all hell will break loose.


Log in to comment.

Attached File ( 1 )

Filename Description Download
rapidxml.hpp.diff2 Initial patch to handle zero-length strings Download

Change ( 1 )

Field Old Value Date By
File Added 315918: rapidxml.hpp.diff2 2009-03-03 03:20 nobody