Bug 448636. Tighten Theora decoder error handling. r=doublec

This commit is contained in:
Ralph Giles 2008-08-04 14:01:35 +12:00
Родитель f117b84642
Коммит a49da51734
3 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,27 @@
Index: /trunk/theora/lib/dec/decapiwrapper.c
===================================================================
--- /trunk/theora/lib/dec/decapiwrapper.c (revision 14385)
+++ /trunk/theora/lib/dec/decapiwrapper.c (revision 15144)
@@ -168,10 +168,13 @@
ogg_int64_t gp;
int ret;
+
+ if(!_td || !_td->i || !_td->i->codec_setup)return OC_FAULT;
api=(th_api_wrapper *)_td->i->codec_setup;
+ if(!api || !api->decode)return OC_FAULT;
ret=th_decode_packetin(api->decode,_op,&gp);
#ifdef _TH_DEBUG_
dframe++;
-#endif
+#endif
if(ret<0)return OC_BADPACKET;
@@ -185,5 +188,7 @@
int ret;
+ if(!_td || !_td->i || !_td->i->codec_setup)return OC_FAULT;
api=(th_api_wrapper *)_td->i->codec_setup;
+ if(!api || !api->decode)return OC_FAULT;
ret=th_decode_ycbcr_out(api->decode,buf);
if(ret>=0){

Просмотреть файл

@ -167,12 +167,15 @@ int theora_decode_packetin(theora_state *_td,ogg_packet *_op){
th_api_wrapper *api;
ogg_int64_t gp;
int ret;
if(!_td || !_td->i || !_td->i->codec_setup)return OC_FAULT;
api=(th_api_wrapper *)_td->i->codec_setup;
if(!api || !api->decode)return OC_FAULT;
ret=th_decode_packetin(api->decode,_op,&gp);
#ifdef _TH_DEBUG_
dframe++;
#endif
#endif
if(ret<0)return OC_BADPACKET;
_td->granulepos=gp;
@ -184,7 +187,9 @@ int theora_decode_YUVout(theora_state *_td,yuv_buffer *_yuv){
th_ycbcr_buffer buf;
int ret;
if(!_td || !_td->i || !_td->i->codec_setup)return OC_FAULT;
api=(th_api_wrapper *)_td->i->codec_setup;
if(!api || !api->decode)return OC_FAULT;
ret=th_decode_ycbcr_out(api->decode,buf);
if(ret>=0){
_yuv->y_width=buf[0].width;

Просмотреть файл

@ -47,3 +47,4 @@ cp $1/lib/internal.h ./lib/internal.h
cp $1/include/theora/theora.h ./include/theora/theora.h
cp $1/include/theora/theoradec.h ./include/theora/theoradec.h
cp $1/include/theora/codec.h ./include/theora/codec.h
patch -p3 <changeset_r15144.diff