Coverage for /pythoncovmergedfiles/medio/medio/src/fuzz_markdown_extended.py: 63%

43 statements  

« prev     ^ index     » next       coverage.py v7.2.1, created at 2023-03-14 06:12 +0000

1###### Coverage stub 

2import atexit 

3import coverage 

4cov = coverage.coverage(data_file='.coverage', cover_pylib=True) 

5cov.start() 

6# Register an exist handler that will print coverage 

7def exit_handler(): 

8 cov.stop() 

9 cov.save() 

10atexit.register(exit_handler) 

11####### End of coverage stub 

12#!/usr/bin/python3 

13# Copyright 2023 Google LLC 

14# 

15# Licensed under the Apache License, Version 2.0 (the "License"); 

16# you may not use this file except in compliance with the License. 

17# You may obtain a copy of the License at 

18# 

19# http://www.apache.org/licenses/LICENSE-2.0 

20# 

21# Unless required by applicable law or agreed to in writing, software 

22# distributed under the License is distributed on an "AS IS" BASIS, 

23# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

24# See the License for the specific language governing permissions and 

25# limitations under the License. 

26import sys 

27import atheris 

28 

29# Beautified from auto-generated fuzzer at: 

30# https://github.com/ossf/fuzz-introspector/pull/872#issuecomment-1450847118 

31# Auto-fuzz heuristics used: py-autofuzz-heuristics-4.1 

32# Imports by the generated code 

33import markdown_it 

34 

35def TestOneInput(data): 

36 fdp = atheris.FuzzedDataProvider(data) 

37 val_1 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 1024)) 

38 val_2 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 1024)) 

39 val_3 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

40 val_4 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

41 val_5 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

42 val_6 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

43 val_7 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

44 val_8 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

45 val_9 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

46 val_10 = fdp.ConsumeUnicodeNoSurrogates(fdp.ConsumeIntInRange(0, 256)) 

47 

48 try: 

49 c1 = markdown_it.main.MarkdownIt() 

50 c1.render(val_1) 

51 c1.parse(val_2) 

52 c1.renderInline(val_3) 

53 c1.parseInline(val_4) 

54 c1.normalizeLink(val_5) 

55 c1.normalizeLinkText(val_6) 

56 c1.disable(val_7) 

57 c1.enable(val_8) 

58 c1.validateLink(val_9) 

59 c1.configure(val_10) 

60 except(ValueError,KeyError,TypeError,): 

61 # Exceptions thrown by the hit code. 

62 pass 

63 

64 

65def main(): 

66 atheris.instrument_all() 

67 atheris.Setup(sys.argv, TestOneInput) 

68 atheris.Fuzz() 

69 

70 

71if __name__ == "__main__": 

72 main()