shoco
shoco copied to clipboard
Input string in compress must be null terminated even when len provided
I had some code where the input string "in" was not null-terminated for: size_t shoco_compress(const char * in, size_t len, char * out, size_t bufsize);
Specifically in := Building.txt/237/245/0 len := 12
shoco_compress encoded the two junk characters /237/245 and returned encoded array of length 10.
By providing a copy of the "in" string with terminating null: in := Building.txt/0 len := 12 it works fine, returning an encoded string length 8.
Easy work around but I was going off the API description: "If [len is] a positive integer, parsing the input will stop after this length, or at a null-char, whatever comes first." - which doesn't seem to be the case.
Hope this makes sense; and thanks for providing this library.
Could you check whether this works now?
Looks fixed now - thanks!