libmix: fix Klocwork issue in parser of h264,vc1,mpeg4
BZ: 73428
fix Klockwork issue in parser
Change-Id: Ib144a599b06b1389c99c3b11267c3fb4b4c47a50
Signed-off-by: ywan171 <yi.a.wang@intel.com>
Reviewed-on: http://android.intel.com:8080/86674
Reviewed-by: Feng, Wei <wei.feng@intel.com>
Reviewed-by: Shi, PingX <pingx.shi@intel.com>
Tested-by: Shi, PingX <pingx.shi@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
diff --git a/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c b/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c
index cb81d27..010e77b 100755
--- a/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c
+++ b/mix_vbp/viddec_fw/fw/codecs/h264/parser/h264parse_dpb.c
@@ -2426,7 +2426,7 @@
int32_t temp_frame_num = 0;
int32_t idx, prev_idc;
int32_t prev_frame_num_plus1_wrap;
- uint32_t temp;
+ uint32_t temp = 0;
int32_t MaxFrameNum = 1 << (pInfo->active_SPS.log2_max_frame_num_minus4 + 4);
seq_param_set_used_ptr active_sps = &pInfo->active_SPS;
h264_DecodedPictureBuffer *p_dpb = &pInfo->dpb;
@@ -2467,9 +2467,11 @@
*/
else if (pInfo->img.frame_num != pInfo->img.PreviousFrameNum)
{
- if (MaxFrameNum)
+ if (MaxFrameNum) {
ldiv_mod_u((uint32_t)(pInfo->img.PreviousFrameNum + 1), (uint32_t)MaxFrameNum, &temp);
-
+ } else {
+ temp = (uint32_t)pInfo->img.PreviousFrameNum + 1;
+ }
prev_frame_num_plus1_wrap = temp;
if (pInfo->img.frame_num != prev_frame_num_plus1_wrap)
{
diff --git a/mix_vbp/viddec_fw/fw/codecs/vc1/parser/vc1parse_bitplane.c b/mix_vbp/viddec_fw/fw/codecs/vc1/parser/vc1parse_bitplane.c
index b39f4ad..4996e28 100644
--- a/mix_vbp/viddec_fw/fw/codecs/vc1/parser/vc1parse_bitplane.c
+++ b/mix_vbp/viddec_fw/fw/codecs/vc1/parser/vc1parse_bitplane.c
@@ -454,6 +454,8 @@
VC1_GET_BITS(1, tempValue);
bpp->invert = (uint8_t) tempValue;
+ bpp->imode = -1;
+
if ((status = vc1_DecodeHuffmanOne(ctxt, &bpp->imode,VC1_BITPLANE_IMODE_TBL)) != VC1_STATUS_OK)
{
return status;
diff --git a/mix_vbp/viddec_fw/fw/parser/vbp_mp42_parser.c b/mix_vbp/viddec_fw/fw/parser/vbp_mp42_parser.c
index abe9f82..859e817 100644
--- a/mix_vbp/viddec_fw/fw/parser/vbp_mp42_parser.c
+++ b/mix_vbp/viddec_fw/fw/parser/vbp_mp42_parser.c
@@ -476,6 +476,10 @@
{
picture_data = vbp_malloc_set0(vbp_picture_data_mp42, 1);
query_data->picture_data = picture_data;
+ if (picture_data == NULL) {
+ query_data->number_picture_data = 0;
+ return;
+ }
}
query_data->number_picture_data = 1;
}
@@ -491,6 +495,9 @@
if (picture_data->next_picture_data == NULL)
{
picture_data->next_picture_data = vbp_malloc_set0(vbp_picture_data_mp42, 1);
+ if (picture_data->next_picture_data == NULL) {
+ return;
+ }
}
query_data->number_picture_data++;