fix(wasm): realloc should handle smaller new size#5234
fix(wasm): realloc should handle smaller new size#5234trim21 wants to merge 7 commits intotree-sitter:masterfrom
Conversation
bab781e to
b196410
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
Changes look good to me, but I'd like to spend some time testing them out. In the meantime, if you could try to come up with a test case so we could have some coverage here that would help a great deal. This can be especially difficult for wasm but it's worth a shot. You may be able to mimic the allocation pattern that causes the failure in a new fixture grammar's external scanner. There are some examples you can work off of in |
2ef3bb1 to
b795182
Compare
b795182 to
e6ad068
Compare
Sorry, I can't reproduce this in testing |
I'll spend some time trying to come up with one when I have a chance then. |
|
CC @maxbrunsfeld if you have a minute. Are the |
Since #5205 (comment) I never be able to connect the dots how wasm32 grammer file works, do you create a new wasm instance for each parsing so |
fix #5205
I know I said I won't spend time on it, but I tried LLM on it and it's amazing, it find this very easily and I think this is right. also tested locally in dprint it works as expected.
In realloc we didn't check the src size and dest size and truncate the memory in memcpy.