Commit ba08e37c authored by Marvin Scholz's avatar Marvin Scholz

dav1d: Fix theoretical invalid pointer dereference

Fix a theoretical bug found by the clang static analyzer:
In theory num_muxers could be smaller than res, never evaluating the
loop (as the condition would be false) but not satisfying the
i == num_muxers case, so proceeding and dereferencing the never
initialized impl pointer.

Fixing this is simple: Changed the num_muxers and index variables
to unsigned so num_muxers can never be smaller than i.
parent d8996b18
......@@ -43,7 +43,7 @@ struct MuxerContext {
#define MAX_NUM_MUXERS 4
static const Muxer *muxers[MAX_NUM_MUXERS];
static int num_muxers = 0;
static unsigned num_muxers = 0;
#define register_muxer(impl) { \
extern const Muxer impl; \
......@@ -81,7 +81,8 @@ int output_open(MuxerContext **const c_out,
{
const Muxer *impl;
MuxerContext *c;
int res, i;
unsigned i;
int res;
if (name) {
for (i = 0; i < num_muxers; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment