There seems to be a bug in the BOM detection for the UTF32 little endian code path: https://github.com/antlr/antlr3/blob/master/runtime/C/src/antlr3filestream.c#L235 Note that `nextChar+1` is compared three times instead of +1, +2 and +3.