aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
748 stars 128 forks source link

Add range check before launching tag readers #41

Closed danii1 closed 7 years ago

danii1 commented 7 years ago

Sometimes tag readers return invalid range in getTagIdentifierByteRange() which cause offset errors(jsmediatags attempts to read data with offset beyond file size). This PR doesn't fixes readers returning wrong ranges, but it adds some sanity checks to prevent unhandled exceptions like in #29.

To reproduce, you can generate small file:

echo hello > 1.wav

Without fix it will throw unhandled exception, with this fix onError will be called.