Skip to content
Snippets Groups Projects
Commit 9db3fb6e authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

oggdec: prevent codec from changing through ogg_replace_stream()


This prevents inconsistencies leading to out of array accesses.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent 599ae999
No related branches found
No related tags found
No related merge requests found
......@@ -174,6 +174,7 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial)
struct ogg_stream *os;
unsigned bufsize;
uint8_t *buf;
struct ogg_codec *codec;
if (ogg->nstreams != 1) {
av_log_missing_feature(s, "Changing stream parameters in multistream ogg", 0);
......@@ -184,6 +185,7 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial)
buf = os->buf;
bufsize = os->bufsize;
codec = os->codec;
if (!ogg->state || ogg->state->streams[0].private != os->private)
av_freep(&ogg->streams[0].private);
......@@ -195,6 +197,7 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial)
os->bufsize = bufsize;
os->buf = buf;
os->header = -1;
os->codec = codec;
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment