Fix av1_receive_compressed_data error reporting. The caller of av1_receive_compressed_data() expects it to set cm->error.error_code to a nonzero error code and return a nonzero value on error. So av1_receive_compressed_data() should do that after a get_free_fb() failure. Document this contract of av1_receive_compressed_data(). BUG=oss-fuzz:9288 Change-Id: I57c8725785182fd9d0993cd3d5cd87f0e0bf004f
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c index cad6c29..ef0d5e4 100644 --- a/av1/decoder/decoder.c +++ b/av1/decoder/decoder.c
@@ -426,7 +426,10 @@ // Find a free frame buffer. Return error if can not find any. cm->new_fb_idx = get_free_fb(cm); - if (cm->new_fb_idx == INVALID_IDX) return AOM_CODEC_MEM_ERROR; + if (cm->new_fb_idx == INVALID_IDX) { + cm->error.error_code = AOM_CODEC_MEM_ERROR; + return 1; + } // Assign a MV array to the frame buffer. cm->cur_frame = &pool->frame_bufs[cm->new_fb_idx];
diff --git a/av1/decoder/decoder.h b/av1/decoder/decoder.h index 9efc4f3..55a7f77 100644 --- a/av1/decoder/decoder.h +++ b/av1/decoder/decoder.h
@@ -206,6 +206,8 @@ int allocated_row_mt_sync_rows; } AV1Decoder; +// Returns 0 on success. Sets pbi->common.error.error_code to a nonzero error +// code and returns a nonzero value on failure. int av1_receive_compressed_data(struct AV1Decoder *pbi, size_t size, const uint8_t **dest);