Easy DoS with malicious packets

Hello,

These fixes will prevent various Out-of-Array accesses (causing a crash) in the parsing code. 

Thanks