parse_riff: ported patch from LibRaw 0.7