[PATCH] dwarf-reader: gnu_hash_tab lookup: fix overflow in bloom hash calculation

Dodji Seketeli dodji@seketeli.org
Tue Mar 17 17:35:13 GMT 2020


Hello Matthias,

Matthias Maennich <maennich@google.com> a écrit:

> For valid values of h1/h2 and c, the signed integer left shift
> expression (1 << (h1 % c)) might overflow, exposing undefined behaviour.
> Fix that by using a data type that can hold the value.
>
> That issue had been reported by ASAN when running test-lookup-syms:
> 	src/abg-dwarf-reader.cc:2028:50: runtime error:
> 		shift exponent 53 is too large for 32-bit type 'int'
>
> 	* src/abg-dwarf-reader.cc(lookup_symbol_from_gnu_hash_tab): Fix
> 	signed integer overflow.

This looks good to me.  I have applied it to master.

Thanks!

-- 
		Dodji


More information about the Libabigail mailing list