History

ogg: fix double free when finding length of small chained oggs.

ogg_save() copies streams[], but doesn't keep track of free()'ed struct members. Thus, if in between a call to ogg_save() and ogg_restore(), streams[].private was free()'ed, this would result in a double free -> crash, which happened when e.g. playing small chained ogg fragments.

Ronald S. Bultje committed 15 years ago

Commit 9ed6cbc1 parent ef1ee361 file · +2 −1Browse files

Unified · Split

libavformat/oggdec.c+2−1
@@ -238,7 +238,8 @@ static int ogg_read_page(AVFormatContext *s, int *str) · 237 unmodified lines
238238
239239 for (n = 0; n < ogg->nstreams; n++) {
240240 av_freep(&ogg->streams[n].buf);
241− av_freep(&ogg->streams[n].private);
241+ if (!ogg->state || ogg->state->streams[n].private != ogg->streams[n].private)
242+ av_freep(&ogg->streams[n].private);
242243 }
243244 ogg->curidx = -1;
244245 ogg->nstreams = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t