ogg: prevent NULL pointer deference in theora gptopts

Additional safety in case a special ogg stream is crafted
with the proper number of

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-03-23 03:43:30 +01:00 committed by Luca Barbato
parent d1f05dd183
commit bb146bb57b
1 changed files with 7 additions and 2 deletions

View File

@ -131,8 +131,13 @@ theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts)
struct ogg *ogg = ctx->priv_data;
struct ogg_stream *os = ogg->streams + idx;
struct theora_params *thp = os->private;
uint64_t iframe = gp >> thp->gpshift;
uint64_t pframe = gp & thp->gpmask;
uint64_t iframe, pframe;
if (!thp)
return AV_NOPTS_VALUE;
iframe = gp >> thp->gpshift;
pframe = gp & thp->gpmask;
if (thp->version < 0x030201)
iframe++;