Double free - 67530995
Hello graphviz team,
As part of our fuzzing efforts at Google, we have identified an issue affecting graphviz (tested with revision * master 510f40d7).
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/
TL;DR instructions:
mkdir project
cp Dockerfile /path/to/project
docker build --no-cache /path/to/project
docker run -it image_id_from_docker_build
From another terminal, outside the container:
docker cp /path/to/attached/reproducer running_container_hostname:/fuzzing/reproducer
(reference: https://docs.docker.com/engine/reference/commandline/cp/)
And, back inside the container:
/fuzzing/repro.sh /fuzzing/reproducer
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:
510f40d7 INFO: Seed: 702270474 /fuzzing/graphviz/fuzzer: Running 1 inputs 1 time(s) each. Running: /tmp/poc libpath/shortest.c:324: triangulation failed libpath/shortest.c:200: destination point not in any triangle
REPRO_START:* master==10==ERROR: AddressSanitizer: attempting double-free on 0x602000060d50 in thread T0: #0 0x4cdd10 in __interceptor_cfree.localalias.1 (/fuzzing/graphviz/fuzzer+0x4cdd10) #1 (closed) 0x7f920ba4ce0e in dot_cleanup_graph /fuzzing/graphviz/lib/dotgen/dotinit.c:167:6 #2 0x7f920c45fc18 in gvFreeLayout /fuzzing/graphviz/lib/gvc/gvlayout.c:109:2 #3 (closed) 0x51d70c in LLVMFuzzerTestOneInput /fuzzing/graphviz/./fuzzer.cc:23:5 #4 0x50f9cc in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/fuzzing/graphviz/fuzzer+0x50f9cc) #5 0x50f18e in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long) (/fuzzing/graphviz/fuzzer+0x50f18e) #6 0x508fed in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*) (/fuzzing/graphviz/fuzzer+0x508fed) #7 0x50a4bf in fuzzer::FuzzerDriver(int*, char***, int ()(unsigned char const, unsigned long)) (/fuzzing/graphviz/fuzzer+0x50a4bf) #8 0x508e9c in main (/fuzzing/graphviz/fuzzer+0x508e9c) #9 0x7f920a3fc2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0) #10 0x41e5a9 in _start (/fuzzing/graphviz/fuzzer+0x41e5a9)
0x602000060d50 is located 0 bytes inside of 16-byte region [0x602000060d50,0x602000060d60) freed by thread T0 here: #0 0x4ce2e0 in realloc (/fuzzing/graphviz/fuzzer+0x4ce2e0) #1 (closed) 0x7f920c49dace in grealloc /fuzzing/graphviz/lib/common/memory.c:56:15 #2 0x7f920ba4b0ad in make_vn_slot /fuzzing/graphviz/lib/dotgen/flat.c:24:2 #3 (closed) 0x7f920ba49ef3 in flat_node /fuzzing/graphviz/lib/dotgen/flat.c:157:10 #4 0x7f920ba48a97 in flat_edges /fuzzing/graphviz/lib/dotgen/flat.c:306:4 #5 0x7f920ba61953 in dot_position /fuzzing/graphviz/lib/dotgen/position.c:129:9 #6 0x7f920ba4da16 in dotLayout /fuzzing/graphviz/lib/dotgen/dotinit.c:326:9 #7 0x7f920ba4d117 in doDot /fuzzing/graphviz/lib/dotgen/dotinit.c:463:2 #8 0x7f920ba4d019 in dot_layout /fuzzing/graphviz/lib/dotgen/dotinit.c:509:22 #9 0x7f920c45fac3 in gvLayoutJobs /fuzzing/graphviz/lib/gvc/gvlayout.c:85:2 #10 0x7f920c470c43 in gvLayout /fuzzing/graphviz/lib/gvc/gvc.c:65:9 #11 0x51d62b in LLVMFuzzerTestOneInput /fuzzing/graphviz/./fuzzer.cc:13:18 #12 0x50f9cc in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/fuzzing/graphviz/fuzzer+0x50f9cc) #13 (closed) 0x508e9c in main (/fuzzing/graphviz/fuzzer+0x508e9c)
previously allocated by thread T0 here: #0 0x4cdec8 in __interceptor_malloc (/fuzzing/graphviz/fuzzer+0x4cdec8) #1 (closed) 0x7f920c49d9cf in gmalloc /fuzzing/graphviz/lib/common/memory.c:47:10 #2 0x7f920c49d998 in zmalloc /fuzzing/graphviz/lib/common/memory.c:25:10 #3 (closed) 0x7f920ba532e8 in allocate_ranks /fuzzing/graphviz/lib/dotgen/mincross.c:1325:39 #4 0x7f920ba5042b in init_mincross /fuzzing/graphviz/lib/dotgen/mincross.c:1197:5 #5 0x7f920ba5006b in dot_mincross /fuzzing/graphviz/lib/dotgen/mincross.c:337:5 #6 0x7f920ba4da01 in dotLayout /fuzzing/graphviz/lib/dotgen/dotinit.c:321:9 #7 0x7f920ba4d117 in doDot /fuzzing/graphviz/lib/dotgen/dotinit.c:463:2 #8 0x7f920ba4d019 in dot_layout /fuzzing/graphviz/lib/dotgen/dotinit.c:509:22 #9 0x7f920c45fac3 in gvLayoutJobs /fuzzing/graphviz/lib/gvc/gvlayout.c:85:2 #10 0x7f920c470c43 in gvLayout /fuzzing/graphviz/lib/gvc/gvc.c:65:9 #11 0x51d62b in LLVMFuzzerTestOneInput /fuzzing/graphviz/./fuzzer.cc:13:18 #12 0x50f9cc in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/fuzzing/graphviz/fuzzer+0x50f9cc) #13 (closed) 0x508e9c in main (/fuzzing/graphviz/fuzzer+0x508e9c)
SUMMARY: AddressSanitizer: double-free (/fuzzing/graphviz/fuzzer+0x4cdd10) in __interceptor_cfree.localalias.1 ==10==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 artifacts_67530995.zip