Comment 7 for bug 39990

Revision history for this message
Nicolas Gama (gama-nicolas) wrote : A possible fix ?

I downloaded samba_source, and built everything using -g3
It appears that the static tables
upcase_table, lowcase_table and valid_table
are not initialized: obviously, the functions init_valid_table and load_case_table are never called
_____________________________________________________
[Thread debugging using libthread_db enabled]
[New Thread -1210394944 (LWP 9957)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210394944 (LWP 9957)]
0xb7d39e89 in toupper_w (val=106) at lib/util_unistr.c:385
385 {
(gdb) info locals
No locals.
(gdb) p upcase_table
$1 = (smb_ucs2_t *) 0x0
(gdb) p lowcase_table
$2 = (smb_ucs2_t *) 0x0
(gdb) p load_case_tables::initialised
$4 = 0
________________________________________________________

To fix it, I just added the missing calls to initialization functions in lib/util_unistr.c:

line 423, in BOOL isvalid83_w(smb_ucs2_t c), insert:
 init_valid_table();

line 413, in BOOL isupper_w(smb_ucs2_t c), insert:
   load_case_tables();

line 404, in BOOL islower_w(smb_ucs2_t c), insert:
   load_case_tables();

line 395, in smb_ucs2_t tolower_w( smb_ucs2_t val ), insert:
   load_case_tables();

line 386, in smb_ucs2_t toupper_w(smb_ucs2_t val), insert:
   load_case_tables();

__________________________________________________

I am not an expert in samba, I don't know if this fix is clean nor how to commit these changes, but it works on my three computers.