Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Port MPEG-TS + Packed Audio AAC transmuxer from TypeScript to Rust (and thus from JS to WebAssembly) #5

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix potential out-of-bounds in rust transmuxer
  • Loading branch information
peaBerberian committed Apr 23, 2023
commit 6ee61f43c0450ce112432e99c2e74880308181da
4 changes: 3 additions & 1 deletion src/rs-core/transmux/nal_unit_producer.rs
Original file line number Diff line number Diff line change
@@ -380,7 +380,9 @@ impl NalUnitProducer {
let mut emu_idx = 0;
(0..new_len)
.map(|_| {
if source_idx == emulation_prevention_bytes_positions[emu_idx] {
if emu_idx < emulation_prevention_bytes_positions.len()
&& source_idx == emulation_prevention_bytes_positions[emu_idx]
{
// Skip this byte
source_idx += 1;
emu_idx += 1;