kixelated / moq-rs

Rust library for Media over QUIC
Apache License 2.0
355 stars 53 forks source link

check if objectreader index is in range before iterating #148

Closed AmadeusWM closed 3 months ago

AmadeusWM commented 3 months ago

I'm getting a panic when I create an single object stream with a group_id that is 1 higher than the previous object stream:

thread 'main' panicked at /moq-rs-amadeus/moq-transport/src/serve/object.rs:133:45:
range start index 100 out of range for slice of length 1

This PR adds a check to make sure we're not trying to read objects that are out of range when the state.objects have been cleared in the ObjectsWriter. And in case the objects have been cleared, all new ObjectReaders are pushed to pending.