You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(gdb) b Strnew_size if n < 0
Breakpoint 1 at 0x4794b8: file Str.c, line 50.
(gdb) r
Breakpoint 1, Strnew_size (n=-3414) at Str.c:50
50 Str x = GC_MALLOC(sizeof(struct _Str));
(gdb) n
51 x->ptr = GC_MALLOC_ATOMIC(n + 1);
(gdb) n
52 x->ptr[0] = '\0';
(gdb) p x->ptr
$1 = 0x7df000 ""
This demonstrate libgc's bug. n+1 == -3413. libgc treat it as unsigned long == 18446744073709548203. The allocation should be failed (either return NULL or abort the program). But it returns 0x7df000.
If continue to run
(gdb) c
Continuing.
Duplicate large block deallocation
Program received signal SIGABRT, Aborted.
0x00007ffff6c70c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
With further investigation, w3m's negative size comes from table.c, renderTable(), line 1733
1733 t->tabwidth[0] = max_width;
where max_width=5632662 but tabwidth[0] is short. After assignment, tabwidth[0]=-3434
found by afl-fuzz
The text was updated successfully, but these errors were encountered:
This bug is interesting since it triggered libgc's issue ivmai/bdwgc#135 as well.
How to reproduce
gdb
This demonstrate libgc's bug. n+1 == -3413. libgc treat it as
unsigned long
== 18446744073709548203. The allocation should be failed (either return NULL or abort the program). But it returns 0x7df000.If continue to run
With further investigation, w3m's negative size comes from table.c, renderTable(), line 1733
where
max_width
=5632662 buttabwidth[0]
isshort
. After assignment,tabwidth[0]=-3434
found by afl-fuzz
The text was updated successfully, but these errors were encountered: