When parsing corrupted files, I frequently ran into un-catchable errors for invalid tag types. Basically, if the type is invalid, this will cause undefined / NaN values for valueSize and valueOffset; because the type is not known readValue in the loop at the end of readTag will not actually do anything, but keep pushing undefined into the res array numValue times. Given bad input numValue can be extremely large so that the loop crashes Node.
When parsing corrupted files, I frequently ran into un-catchable errors for invalid tag types. Basically, if the type is invalid, this will cause
undefined
/NaN
values forvalueSize
andvalueOffset
; because the type is not knownreadValue
in the loop at the end ofreadTag
will not actually do anything, but keep pushingundefined
into theres
arraynumValue
times. Given bad inputnumValue
can be extremely large so that the loop crashes Node.