Hello InChI team,
As part of our fuzzing efforts at Google, we have identified an issue affecting
InChI (tested with revision v1.04, September 2011).
To reproduce, we are attaching a Dockerfile which compiles the project with
LLVM, taking advantage of the sanitizers that it offers. More information about
how to use the attached Dockerfile can be found here:
https://docs.docker.com/engine/reference/builder/
Instructions:
unzip artifacts_121411204.zip
docker build --build-arg SANITIZER=address --tag=autofuzz-InChI-121411204 autofuzz_121411204
docker run --entrypoint /fuzzing/repro.sh --cap-add=SYS_PTRACE -v $PWD/autofuzz_121411204/poc-b3e2e1ef49c29516ca8a0c806751351eae0c221adc8c47d4d533ffa113219a81_min:/tmp/poc autofuzz-InChI-121411204 "" /tmp/poc
docker run --cap-add=SYS_PTRACE -v $PWD/autofuzz_121411204/poc-b3e2e1ef49c29516ca8a0c806751351eae0c221adc8c47d4d533ffa113219a81_min:/tmp/poc -it autofuzz-InChI-121411204
Alternatively, and depending on the bug, you could use gcc, valgrind or other
instrumentation tools to aid in the investigation. The sanitizer error that we
encountered is here:
INFO: Seed: 1637068380
INFO: Loaded 0 modules (0 guards):
/fuzzing/fuzzer: Running 1 inputs 500 time(s) each.
Running: /tmp/poc-b3e2e1ef49c29516ca8a0c806751351eae0c221adc8c47d4d533ffa113219a81
ASAN:DEADLYSIGNAL
=================================================================
==6==ERROR: AddressSanitizer: SEGV on unknown address 0x62473aa0ac60 (pc 0x00000066b13b bp 0x7ffc36720930 sp 0x7ffc367208e0 T0)
==6==The signal is caused by a READ memory access.
#0 0x66b13a in CopySegment(tagINChI*, tagINChI*, int, int, int) /fuzzing/INCHI-1-API/INCHI_API/inchi_dll/ichiread.c:7944:63
#1 0x67b915 in ParseSegmentIsoAtoms(char const*, int, tagINChI**, int*, int, int*) /fuzzing/INCHI-1-API/INCHI_API/inchi_dll/ichiread.c:4983:23
#2 0x669526 in ReadInChILine(tagOutputStream*, tagLine*, char**, int*, tagINChI* (*) [2], int (*) [2], tagRemovedAndExchangeableH (*) [2], int (*) [2][2], int*, int*, unsigned char*) /fuzzing/INCHI-1-API/INCHI_API/inchi_dll/ichiread.c:4646:19
#3 0x65b3f7 in InChILine2Data(tagOutputStream*, tagLine*, char**, int*, int*, tagINChI* (*) [2], int (*) [2], tagRemovedAndExchangeableH (*) [2], int (*) [2][2], int, int, unsigned long, int*, int*, unsigned char*) /fuzzing/INCHI-1-API/INCHI_API/inchi_dll/ichiread.c:2327:11
#4 0x658fa5 in ReadWriteInChI /fuzzing/INCHI-1-API/INCHI_API/inchi_dll/ichiread.c:571:23
#5 0x53dd6b in GetINCHIfromINCHI /fuzzing/INCHI-1-API/INCHI_API/inchi_dll/inchi_dll.c:1953:16
#6 0x518735 in LLVMFuzzerTestOneInput /fuzzing/security-research-pocs/autofuzz/inchi_fuzzer.cc:23:3
#7 0x523ede in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/fuzzing/fuzzer+0x523ede)
#8 0x51903e in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/fuzzing/fuzzer+0x51903e)
#9 0x51d547 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/fuzzing/fuzzer+0x51d547)
#10 0x518d5b in main (/fuzzing/fuzzer+0x518d5b)
#11 0x7f126d1752e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#12 0x41ff89 in _start (/fuzzing/fuzzer+0x41ff89)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /fuzzing/INCHI-1-API/INCHI_API/inchi_dll/ichiread.c:7944:63 in CopySegment(tagINChI*, tagINChI*, int, int, int)
==6==ABORTING
We will gladly work with you so you can successfully confirm and reproduce this
issue. Do let us know if you have any feedback surrounding the documentation.
Once you have reproduced the issue, we'd appreciate to learn your expected
timeline for an update to be released. With any fix, please attribute the report
to "Google Autofuzz project".
We are also pleased to inform you that your project is eligible for inclusion to
the OSS-Fuzz project, which can provide additional continuous fuzzing, and
encourage you to investigate integration options.
Don't hesitate to let us know if you have any questions!
Google AutoFuzz Team