On Sat, Sep 21, 2019 at 10:07:25 +0530, Gyan wrote: [...] > Coverity reports three issues arising from this patchset, actually one > issue, having an instance in each of the three init () functions. [...] > c->hashes = av_mallocz_array(1, sizeof(c->hashes)); [...] > "Passing argument "8UL /* sizeof (c->hashes) */" to function > "av_mallocz_array" and then casting the return value to "struct > AVHashContext **" is suspicious. In this particular case "sizeof (struct > AVHashContext **)" happens to be equal to "sizeof (struct AVHashContext > *)", but this is not a portable assumption."
Now that you point it out, it's obvious. Shame on me, it wasn't before. (For the record, for those who want to learn what I learned: c->hashes = av_mallocz_array(1, sizeof(*c->hashes)); would have been correct.) Too bad we don't have other static analysis tools to catch this. (Or would cppcheck have caught this?) I'm aware that Coverity only operates on the actual repo, not on submitted patches. Anyway, a patch to fix this is posted. Thanks, Moritz _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".