bin_to_res_menuexitems can be called with random data offsets (and thus
remaining lengths), confusing code that expects 4-byte aligned data.
Prevent an item length adjustment for alignment exceeding the
remaining length and then overflowing.
itemlen = 14 + slen * 2 + 2;
itemlen = (itemlen + 3) &~ 3;
+ /* Don't allow rounding up of itemlen to exceed length. This
+ is an anti-fuzzer measure to cope with unexpected offsets and
+ lengths. */
+ if (itemlen > length)
+ itemlen = length;
if ((flags & 1) == 0)
{