From ec6e5c21aa44b667ec4ca7d7b8810a130b7f33a0 Mon Sep 17 00:00:00 2001 From: jesslatimer <97333535+jesslatimer@users.noreply.github.com> Date: Mon, 6 Mar 2023 10:38:32 -0800 Subject: [PATCH] mdurl: fix early string consumer exhaustion (#9864) This change removes `sys.maxsize` and uses a defined string size so that the data is not consumed all at once when first used. This results in increased code coverage. --- projects/mdurl/fuzz_mdurl.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/projects/mdurl/fuzz_mdurl.py b/projects/mdurl/fuzz_mdurl.py index 7da76fd95..77c373b8b 100644 --- a/projects/mdurl/fuzz_mdurl.py +++ b/projects/mdurl/fuzz_mdurl.py @@ -18,17 +18,17 @@ import mdurl def TestOneInput(data): - fdp = atheris.FuzzedDataProvider(data) - mdurl.parse(fdp.ConsumeUnicodeNoSurrogates(sys.maxsize)) - mdurl.decode(fdp.ConsumeUnicodeNoSurrogates(sys.maxsize)) - mdurl.encode(fdp.ConsumeUnicodeNoSurrogates(sys.maxsize)) + fdp = atheris.FuzzedDataProvider(data) + mdurl.parse(fdp.ConsumeUnicodeNoSurrogates(512)) + mdurl.decode(fdp.ConsumeUnicodeNoSurrogates(512)) + mdurl.encode(fdp.ConsumeUnicodeNoSurrogates(512)) def main(): - atheris.instrument_all() - atheris.Setup(sys.argv, TestOneInput) - atheris.Fuzz() + atheris.instrument_all() + atheris.Setup(sys.argv, TestOneInput) + atheris.Fuzz() if __name__ == "__main__": - main() + main()