-
Notifications
You must be signed in to change notification settings - Fork 624
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
1.5K input consumes 8Gb of RAM #161
Comments
Yeah, exponential growth in buffer is well-known. Can happen in much shorter fonts even. See eg: We have to put an artificial limit in. Something like 16x the starting length... @jfkthame WDYT? Is there any need for that number to be configurable? |
I doubt it needs to be configurable, but you might as well use a #define that could be overridden if someone really wants to (or just for testing purposes)....
(Picking 32 as default on the grounds that compatibility decomps in Unicode can stretch to at least 18 characters -- U+FDFA is the longest one I can think of offhand. It seems unlikely anyone would really want to do that in a 'ccmp' feature or w/e, but we can claim that it'd at least be possible.) |
Good point. 32 it is then. I'll try to implement this soon. |
I'm going to make the rule be inputlen * HB_BUFFER_MAX_EXPANSION_FACTOR + 8192 just to make it impossible to hit the condition for real-world use-cases, while still catching abusive ones. |
After limiting memory expansion, I also fixed a hang... I added more -D stuff to hb/test/fuzzing/Makefile.am, specifically:
|
Now the fuzzer crashes like this (see #157 (comment)):
|
Thanks. We never tested the OOM codepaths. We are now. Guess I'll postpone a release until next week so I can sort these out. |
Fixes assert fail in #161 with libharfbuzz-fuzzing.
Should be fixed. |
Confirmed, fuzzing restarted, it's running at nice 4000 exec/s |
Excellent! I finally go ahead and make that overdue release! |
found by libFuzzer, see #139
Feed the attached input to the fuzzer target function, observe it consume 8Gb RAM.
crash-3511ff5c1647150595846ac414c595cccac34f18.pdf
Huge allocations seem to be coming from here:
The text was updated successfully, but these errors were encountered: