Hi sqlite3 maintainers,
I found a use-after-free bugs in salite3.
Here is the stack trace:
==12241== ERROR: AddressSanitizer: heap-use-after-free on address
0xb5a00590 at pc 0x8777099 bp 0xbfd44df8 sp 0xbfd44dec
READ of size 1 at 0xb5a00590 thread T0
#0 0x8777098 in sqlite3Strlen30 /home/b/asan/sqlite/sqlite3.c:27620
#1 0x8777098 in sqlite3ParseUri /home/b/asan/sqlite/sqlite3.c:141789
#2 0x877b78b in openDatabase /home/b/asan/sqlite/sqlite3.c:142173
#3 0x80805ea in open_db.part.12 /home/b/asan/sqlite/src/shell.c:2426
#4 0x80964a0 in open_db /home/b/asan/sqlite/src/shell.c:5460
#5 0x80964a0 in runOneSqlLine /home/b/asan/sqlite/src/shell.c:5442
#6 0x8097c7f in process_input /home/b/asan/sqlite/src/shell.c:5546
#7 0x8072f49 in main /home/b/asan/sqlite/src/shell.c:6153
#8 0xb602ea82 (/lib/i386-linux-gnu/libc.so.6+0x19a82)
#9 0x80761b0 in _start (/home/b/asan/sqlite/sqlite3+0x80761b0)
0xb5a00590 is located 0 bytes inside of 2-byte region
[0xb5a00590,0xb5a00592)
freed by thread T0 here:
#0 0xb61fb774 (/usr/lib/i386-linux-gnu/libasan.so.0+0x16774)
#1 0x810eb4e in sqlite3_free /home/b/asan/sqlite/sqlite3.c:24562
previously allocated by thread T0 here:
#0 0xb61fb854 (/usr/lib/i386-linux-gnu/libasan.so.0+0x16854)
#1 0x82be0ff in sqlite3MemMalloc /home/b/asan/sqlite/sqlite3.c:20673
SUMMARY: AddressSanitizer: heap-use-after-free
/home/b/asan/sqlite/sqlite3.c:141785 sqlite3ParseUri
Shadow bytes around the buggy address:
0x36b40060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b40070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b40080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36b40090: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa fd fd
0x36b400a0: fa fa fd fa fa fa fd fd fa fa fd fd fa fa fd fd
=>0x36b400b0: fa fa[fd]fa fa fa fd fd fa fa 00 fa fa fa 00 fa
0x36b400c0: fa fa 00 00 fa fa 00 fa fa fa 00 00 fa fa 00 fa
0x36b400d0: fa fa 00 00 fa fa 00 fa fa fa 00 00 fa fa 00 04
0x36b400e0: fa fa 00 fa fa fa 00 00 fa fa 00 05 fa fa 00 04
0x36b400f0: fa fa 00 fa fa fa 00 00 fa fa 00 00 fa fa 00 fa
0x36b40100: 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
Heap righ redzone: fb
Freed Heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
And test case attached.
Thanks and Regards,
Junjie
.
.'op'/
.'op'-.
;
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users