rdkcentral / ut-control

Control & KVP Module to support vDevice
Apache License 2.0
2 stars 0 forks source link

i42: ut-core: ut_kvp_getListCount failure due to random count value. #42

Open srinivasgtl opened 2 months ago

srinivasgtl commented 2 months ago

We had a situation where the API ut_kvp_getListCount has been triggered with some wrong profiles which will eventually fail. But the problem here is that the var count is not initialized due to which it generates a random value instead of zero during the failure. This random value created infinite loops in some of the VTS test cases.

Failure: if (fy_node_is_sequence(node)) at line 600 fails due to some bad reason and as the count variable is not initialized, it will return a random value from here.

Solution: initialize the variable count to 0.

Please also check that the count is of type "uint32_t ", while we check this for -1 in certain cases.

 count = fy_node_sequence_item_count(node);
        if (count == -1)
        {
            UT_LOG_ERROR("fy_node_sequence_item_count() returned error\n ");
            return 0;
        }
kanjoe24 commented 1 month ago

Hello @srinivasgtl , I have a PR for this issue. Can your team kindly test and provide me with feedback please.

Regards Jyotsna