vpx_codec_decode: check data size
When a valid data pointer is given make sure the size is greater than
zero.
A previous check for vp9 was incorrectly removed in:
7050074 Make the api behavior conform to api spec.
No semantics for valid pointers + 0-sized frames are defined for VPx
codecs, so move the check to vpx_codec_decode(). This avoids an assert
in vp9.
+ add some basic invalid param testing for decoder init/decode/destroy
Change-Id: I99f9cef6076d15874fd72ac973f2685d8a2353c3
diff --git a/vpx/src/vpx_decoder.c b/vpx/src/vpx_decoder.c
index 276238b..a90fe95 100644
--- a/vpx/src/vpx_decoder.c
+++ b/vpx/src/vpx_decoder.c
@@ -119,7 +119,7 @@
/* Sanity checks */
/* NULL data ptr allowed if data_sz is 0 too */
- if (!ctx || (!data && data_sz))
+ if (!ctx || (!data && data_sz) || (data && !data_sz))
res = VPX_CODEC_INVALID_PARAM;
else if (!ctx->iface || !ctx->priv)
res = VPX_CODEC_ERROR;