mtth / avsc

Avro for JavaScript :zap:
MIT License
1.27k stars 147 forks source link

Off-by-one errors in Tap bounds checks? #421

Closed valadaptive closed 1 year ago

valadaptive commented 1 year ago

In Tap, there are a lot of this.pos > buf.length checks. Since Buffer.length is always 1 greater than the last valid byte index, shouldn't they be this.pos >= buf.length instead?

mtth commented 1 year ago

this.pos represents the position of the next write so these checks may be fine. Is there one in particular that looks suspicious to you?

valadaptive commented 1 year ago

Seems to all work out now; never mind