[xiph-commits] r8999 - experimental/derf/theora-exp/lib
tterribe at motherfish-iii.xiph.org
tterribe at motherfish-iii.xiph.org
Tue Mar 1 08:40:59 PST 2005
Author: tterribe
Date: 2005-03-01 08:40:57 -0800 (Tue, 01 Mar 2005)
New Revision: 8999
Modified:
experimental/derf/theora-exp/lib/decode.c
experimental/derf/theora-exp/lib/encode.c
Log:
Make theora_encode_alloc and theora_decode_alloc return NULL when given invalid theora_info parameters, as documented.
Modified: experimental/derf/theora-exp/lib/decode.c
===================================================================
--- experimental/derf/theora-exp/lib/decode.c 2005-03-01 16:40:03 UTC (rev 8998)
+++ experimental/derf/theora-exp/lib/decode.c 2005-03-01 16:40:57 UTC (rev 8999)
@@ -176,12 +176,14 @@
-static void oc_dec_init(oc_dec_ctx *_dec,const theora_info *_info,
+static int oc_dec_init(oc_dec_ctx *_dec,const theora_info *_info,
const theora_setup_info *_setup){
int qti;
int pli;
int qi;
- oc_state_init(&_dec->state,_info);
+ int ret;
+ ret=oc_state_init(&_dec->state,_info);
+ if(ret<0)return ret;
oc_huff_trees_copy(_dec->huff_tables,_setup->huff_tables);
for(qti=0;qti<2;qti++)for(pli=0;pli<3;pli++){
_dec->state.dequant_tables[qti][pli]=
@@ -212,6 +214,7 @@
_dec->pp_frame_data=NULL;
_dec->stripe_cb.ctx=NULL;
_dec->stripe_cb.stripe_decoded=NULL;
+ return 0;
}
static void oc_dec_clear(oc_dec_ctx *_dec){
@@ -1821,7 +1824,10 @@
oc_dec_ctx *dec;
if(_info==NULL||_setup==NULL)return NULL;
dec=_ogg_malloc(sizeof(*dec));
- oc_dec_init(dec,_info,_setup);
+ if(oc_dec_init(dec,_info,_setup)<0){
+ _ogg_free(dec);
+ return NULL;
+ }
dec->state.curframe_num=0;
return dec;
}
Modified: experimental/derf/theora-exp/lib/encode.c
===================================================================
--- experimental/derf/theora-exp/lib/encode.c 2005-03-01 16:40:03 UTC (rev 8998)
+++ experimental/derf/theora-exp/lib/encode.c 2005-03-01 16:40:57 UTC (rev 8999)
@@ -2516,7 +2516,10 @@
oc_enc_ctx *enc;
if(_info==NULL)return NULL;
enc=_ogg_malloc(sizeof(*enc));
- oc_enc_init(enc,_info);
+ if(oc_enc_init(enc,_info)<0){
+ _ogg_free(enc);
+ return NULL;
+ }
return enc;
}
More information about the commits
mailing list