ndmitchell / hexml

A bad XML parser
Other
19 stars 4 forks source link

Avoid memory copying #3

Open ndmitchell opened 7 years ago

ndmitchell commented 7 years ago

Currently the first thing the Haskell layer does is append \0 to the string, forcing an entire copy and realloc. That's expensive - can it be avoided? If the last character is a known character, e.g. >, we could fake mark that the end of the string and only when looking for > would we have a special case. Do we have a buffer overrun attack that way?