Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left shift causes an undefined-behavior in function cli_hex2num() #1359

Open
skorpion98 opened this issue Sep 3, 2024 · 0 comments
Open

Comments

@skorpion98
Copy link

Describe the bug

We found an undefined-behavior caused by a left shift operation in function cli_hex2num()

ret = (ret << 4) | hexval;
after testing one of the harnesses provided on the OSS-Fuzz repository (clamav_dbload_YARA_fuzzer).
More specifically, the program performs a left shift of 4 places of a variable of type ‘int’, but the result cannot be represented by the destination type ‘int’.

How to reproduce the problem

In the attached archive you will find:

  • the executable on which we performed our tests
  • the input file that caused the bug
  • the output of ASan confirming our finding

To reproduce the error, simply run the given binary with the testcase files with a command like: `./clamav_dbload_YARA_fuzzer /path_to_testcases/input

The program has been tested on the standard Docker image provided on OSS-Fuzz using Ubuntu 20.04, providing AFL++ as fuzzing engine and build flag --sanitizer=undefined.

The hash commit used to perform the tests is 25ca17b

Environment

  • OS: Linux
  • Version/Distribution: Ubuntu 20.04
  • Architecture: x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant