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.
This commit is contained in:
jesslatimer 2023-03-06 10:38:32 -08:00 committed by GitHub
parent 56283083a9
commit ec6e5c21aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -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()