Open
Conversation
66c1af6 to
ff80f13
Compare
03db774 to
b1d84fc
Compare
When luzer runs a test with broken dictionary it runs `LLVMFuzzerRunDriver()` that prints an error message: ParseDictionaryFile: error in line 1 "\\200\\000" # Uses: 283 the it frees argv[] and returns. A function `free_argv()` frees argv[] again and we observe a segmentation fault. The problem was fixed by the previous commit. The patch adds an additional test for the problem. Follows up #52 Closes #65
3b09aa9 to
9a6f771
Compare
Buristan
requested changes
Nov 10, 2025
Collaborator
Buristan
left a comment
There was a problem hiding this comment.
Sergey,
Thanks for the patch!
I suppose the next commit may be squashed into this one as well.
Please consider my comment below.
| LUA_SETHOOK(L, debug_hook, 0, 0); | ||
|
|
||
| /* Prevents memory leaks on module exit. */ | ||
| lua_gc(L, LUA_GCCOLLECT, 0); |
Collaborator
There was a problem hiding this comment.
I suppose we have several smoking guns here:
- Since Lua (and therefore LuaJIT) has the GC-based memory management model, it may accumulate memory between iterations of state mutations in the TestOneInput. Libfuzzer checks the possible leaks during fuzzing between state mutations. Hence, we should add
-detect_leaks=0(see options) to the fuzzer options to be sure that we don't fail valid runs due to these false positives. This option disables only intermediate checks. The shutdown check is still enabled (but it may be ignored if you specify the environment variableLSAN_OPTIONS). Adding oflua_gc(), may not be so helpful if the object is allocated once at the first call (loading library viarequire) and cleared on the exit. - Even with the aforementioned option the
lua_close()isn't called since the process is finished by the atexit handler, which is set in theFuzzerDriver(). So, we will observe leaks of the FDP object allocated vianew.
Owner
Author
There was a problem hiding this comment.
Also https://github.com/google/atheris/blob/master/native_extension_fuzzing.md#leak-detection
Leak detection
Python is known to leak certain data, such as at interpreter initialization time. You should disable leak detection, for example with -detect_leaks=0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #52