Coverage for /pythoncovmergedfiles/medio/medio/src/fuzz_normalize.py: 24%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

21 statements  

1import pysecsan; pysecsan.add_hooks(); 

2###### Coverage stub 

3import atexit 

4import coverage 

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

6cov.start() 

7# Register an exist handler that will print coverage 

8def exit_handler(): 

9 cov.stop() 

10 cov.save() 

11atexit.register(exit_handler) 

12####### End of coverage stub 

13#!/usr/bin/python3 

14# Copyright 2022 Google LLC 

15# 

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

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

18# You may obtain a copy of the License at 

19# 

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

21# 

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

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

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

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

26# limitations under the License. 

27 

28import os 

29import sys 

30import atheris 

31 

32from charset_normalizer import from_bytes 

33 

34 

35def TestOneInput(data): 

36 """Simply pass fuzz data directly into charset_normaliser""" 

37 # No exceptions thrown 

38 from_bytes(data) 

39 

40 

41def main(): 

42 atheris.instrument_all() 

43 atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) 

44 atheris.Fuzz() 

45 

46 

47if __name__ == "__main__": 

48 main()