Skip to content

Small improvements an fixes on stb_vorbis#1889

Open
lassade wants to merge 1 commit into
nothings:masterfrom
lassade:stb_vorbis_minor_fixes_and_improvments
Open

Small improvements an fixes on stb_vorbis#1889
lassade wants to merge 1 commit into
nothings:masterfrom
lassade:stb_vorbis_minor_fixes_and_improvments

Conversation

@lassade

@lassade lassade commented Feb 14, 2026

Copy link
Copy Markdown
  • Reduces the upper bounds of some arrays across the code as explaned here stb_vorbis floor1 reserves too much memory #1888 as well some other ones
  • Fixes compiler bug when builtind with -Werror on line 1404, the statement f->stream_start + loc < f->stream_start is always false
  • Fixes max_part_read when computing how much temporary memory is needed, it's a non issue because imdct_mem is always bigger than classify_mem by a lot I don't see a cenario when it doesn't. the fix is pretty easy: the max actual_size is f->blocksize_1 and not f->blocksize_1/2 this happens on residue type 2 shown at decode_residue line 2111

@lassade lassade changed the title Small improvements an fixes Small improvements an fixes on stb_vorbis Feb 14, 2026
@lassade
lassade force-pushed the stb_vorbis_minor_fixes_and_improvments branch from 9178356 to 37d8171 Compare February 14, 2026 14:55
Comment thread stb_vorbis.c
Comment on lines +724 to +726
uint16 Xlist[65]; // varies
uint8 sorted_order[65];
uint8 neighbors[65][2];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Opportunity to document why this is 65, or use something like VIF_POSIT+2?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't know why but it is in the spec in at the last paragraph it says "Vector [floor1_x_list] is limited to a maximum length of 65 elements;"

Comment thread stb_vorbis.c
Comment on lines -4164 to +4166
unsigned int actual_size = f->blocksize_1 / 2;
unsigned int actual_size = f->blocksize_1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicate of #1487

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this loop looks for the maximum ammount of memory needed, in my test data I don't have a single vorbis file that doesn't have a residue type 2 so using blocksize_1 is good enough

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.

3 participants