Skip to content

Commit 2938417

Browse files
committed
fix(sfloader): move INFO chunk FLUID_LOG into the branch where item.chr is allocated
The debug log referencing item.chr was placed at the end of the outer else block, reachable by code paths where item.fcc was never allocated, causing a potential NULL pointer dereference and a -Wmaybe-uninitialized warning. Move the log to immediately after the successful fread(), where item.chr is guaranteed to be valid. Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
1 parent 148d10b commit 2938417

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/sfloader/fluid_sffile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ static int process_info(SFData *sf, int size)
855855

856856
/* force terminate info item */
857857
item.chr[chunk.size] = '\0';
858+
FLUID_LOG(FLUID_DBG, "INFO chunk %c%c%c%c (%d bytes) -> %s", p[0], p[1], p[2], p[3], chunk.size, item.chr);
858859
}
859860
}
860861
else
@@ -873,7 +874,6 @@ static int process_info(SFData *sf, int size)
873874
return FALSE;
874875
}
875876
}
876-
FLUID_LOG(FLUID_DBG, "INFO chunk %c%c%c%c (%d bytes) -> %s", p[0], p[1], p[2], p[3], chunk.size, item.chr);
877877
}
878878

879879
size -= chunk.size;

0 commit comments

Comments
 (0)