Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input string in compress must be null terminated even when len provided #16

Open
dgreatwood opened this issue Dec 6, 2015 · 2 comments

Comments

@dgreatwood
Copy link

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.

@charmander
Copy link
Contributor

Could you check whether this works now?

@dgreatwood
Copy link
Author

Looks fixed now - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants