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

Shift operation causing undefined-behavior in function hash() #1360

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

Shift operation causing undefined-behavior in function hash() #1360

skorpion98 opened this issue Sep 3, 2024 · 0 comments

Comments

@skorpion98
Copy link

Describe the bug

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

result ^= ROTATE_INT32(byte_to_int32[*buffer], i);

after testing one of the harnesses provided on the OSS-Fuzz repository (clamav_dbload_YARA_fuzzer).
More specifically, the program performs a shift with exponent 32 on an uint8_t array element and attempts to store the result in a variable of type uint32_t, but the result cannot be represented by the destination type.

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
@skorpion98 skorpion98 changed the title undefined-behavior in function hash() Shift operation causing undefined-behavior in function hash() Sep 3, 2024
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