This changes the binary mask used to discard the 1-bit while seeking through wav files from 0xfffffe (which casted to 32bit is 0x00fffffe) to 0xfffffffe. This prevents a serious issues which may arise when parsing large files.
This mask is used in addition with a offset of 1 to pad the chunk size to even numbers.
Without this adjustment, files which force the parser to seek beyond this limit would end up seeking to a quasi-random position of the file, try to read chunk ID and size from there and continue. This, leads to the parser basically jumping randomly within the file, interpreting random data as chunk size and chunk id.
One could argue that a 64 bit integer should be used for this operation? Though wav itself uses 32bit integers to determine chunk sizes.
This changes the binary mask used to discard the 1-bit while seeking through wav files from
0xfffffe
(which casted to 32bit is0x00fffffe
) to0xfffffffe
. This prevents a serious issues which may arise when parsing large files. This mask is used in addition with a offset of 1 to pad the chunk size to even numbers.Without this adjustment, files which force the parser to seek beyond this limit would end up seeking to a quasi-random position of the file, try to read chunk ID and size from there and continue. This, leads to the parser basically jumping randomly within the file, interpreting random data as chunk size and chunk id.
One could argue that a 64 bit integer should be used for this operation? Though wav itself uses 32bit integers to determine chunk sizes.