Skip to content

suspicious discarding of buffer #3455

@vrtgs

Description

@vrtgs

code for encoding here creates a new buffer called t35_buf then writes it... then clears it before it gets dropped?

rav1e/src/encoder.rs

Lines 3785 to 3793 in b7bf390

for t35 in fi.t35_metadata.iter() {
let mut t35_buf = Vec::new();
let mut t35_bw = BitWriter::endian(&mut t35_buf, BigEndian);
t35_bw.write_t35_metadata_obu(t35).unwrap();
packet.write_all(&t35_buf).unwrap();
t35_buf.clear();
}

there is also the fact that this suspicously isn't writing to the packet directly but that can be for bit padding or whatever I am not too sure, but it seems pointless to clear the buffer before dropping unless the intention was to reuse said buffer if that wasn't the intention it probably would be good to implement by just pulling the buffers declaration out of the loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions