Skip to content

Handle zero-length uint, int and float encoding - #85

Closed
metamuffin wants to merge 1 commit into
mozilla:masterfrom
metamuffin:zero-length-uint
Closed

Handle zero-length uint, int and float encoding#85
metamuffin wants to merge 1 commit into
mozilla:masterfrom
metamuffin:zero-length-uint

Conversation

@metamuffin

Copy link
Copy Markdown
Contributor

See https://bugzilla.mozilla.org/show_bug.cgi?id=2045549

I also removed the comment /* Length == 10 not implemented. */ as length 10 floats as invalid according to the RFC.

The test media is 1 second of testsrc2 where the Timestamp element of the first (only) cluster uses the zero-length uint encoding.

@kinetiknz
kinetiknz requested review from ashleyz and kinetiknz and removed request for ashleyz June 11, 2026 20:42

@kinetiknz kinetiknz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread src/nestegg.c
if (r != 1)
return r;

if (length < sizeof(int64_t)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that ne_read_uint returns success for length == 0, this needs to bail early for length == 0 to avoid UB here.

I'll fix this when I merge the change.

Comment thread src/nestegg.c
} value;
int r;

/* Length == 10 not implemented. */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to remove this, it was only ever mentioned in early Matroska specs.

@kinetiknz

Copy link
Copy Markdown
Collaborator

Merged as 1c9936b

@kinetiknz kinetiknz closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants