20 Jul
2019
20 Jul
'19
3:47 a.m.
Looking further into this segfault at
settings-parser.c:setting_copy():1519
*dest_size = *src_size;
*src_size points to type size_t (typedef unsigned long), a 4-byte aligned value consistent with a 32-bit build. This is mismatched with declared type
(gdb) whatis src_size
type = const uoff_t *
(gdb) whatis uoff_t
type = unsigned long long
(gdb) p sizeof(uoff_t)
$1 = 8
resulting in the segfault when *src_size is dereferened. The implied condition of this code segment is typeof(uoff_t)==typeof(size_t) which is clearly not the case.
I'm not sure how/if uoff_t is defined, but configure reports
checking for uoff_t... no
checking type of off_t... long long
The latter is weird, because if I compile and run using the same compiler flags
#include <stdio.h>
int main(void) { printf("%d %d\n",sizeof(long long),sizeof(off_t)); }
the output is "8 4".
Joseph Tam jtam.home@gmail.com