[2019-08-02] - Found with Honggfuzz - CVE-2019-14528 Heap-based buffer overflow in the read_literal() function, in cobc/scanner.l. Issue can be reproduced by running: ``` cobc test03.cob ``` ``` ================================================================= ==4209==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62100000d900 at pc 0x0000005cecaa bp 0x7ffc17a9ac90 sp 0x7ffc17a9ac88 WRITE of size 1 at 0x62100000d900 thread T0 #0 0x5ceca9 in read_literal /home/fcambus/gnucobol/cobc/scanner.l:1258:15 #1 0x5b2476 in yylex /home/fcambus/gnucobol/cobc/scanner.l:321:2 #2 0x5510db in yyparse /home/fcambus/gnucobol/cobc/parser.c:11820:16 #3 0x51d901 in process_translate /home/fcambus/gnucobol/cobc/cobc.c:6937:8 #4 0x5014d7 in process_file /home/fcambus/gnucobol/cobc/cobc.c:8037:19 #5 0x4faaaf in main /home/fcambus/gnucobol/cobc/cobc.c:8219:12 #6 0x7fe2aadd8b6a in __libc_start_main /build/glibc-KRRWSm/glibc-2.29/csu/../csu/libc-start.c:308:16 #7 0x41c539 in _start (/usr/local/bin/cobc+0x41c539) 0x62100000d900 is located 0 bytes to the right of 4096-byte region [0x62100000c900,0x62100000d900) allocated by thread T0 here: #0 0x4c82ff in realloc /build/llvm-toolchain-8-F3l7P1/llvm-toolchain-8-8/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:165:3 #1 0x4f7b7c in cobc_realloc /home/fcambus/gnucobol/cobc/cobc.c:1032:9 #2 0x5ce65c in read_literal /home/fcambus/gnucobol/cobc/scanner.l:1212:17 #3 0x5b2476 in yylex /home/fcambus/gnucobol/cobc/scanner.l:321:2 #4 0x5510db in yyparse /home/fcambus/gnucobol/cobc/parser.c:11820:16 #5 0x51d901 in process_translate /home/fcambus/gnucobol/cobc/cobc.c:6937:8 #6 0x5014d7 in process_file /home/fcambus/gnucobol/cobc/cobc.c:8037:19 #7 0x4faaaf in main /home/fcambus/gnucobol/cobc/cobc.c:8219:12 #8 0x7fe2aadd8b6a in __libc_start_main /build/glibc-KRRWSm/glibc-2.29/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fcambus/gnucobol/cobc/scanner.l:1258:15 in read_literal Shadow bytes around the buggy address: 0x0c427fff9ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff9ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff9af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff9b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff9b10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c427fff9b20:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff9b30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff9b40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff9b50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff9b60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff9b70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==4209==ABORTING ```