Skip to content

Commit

Permalink
bpm: Fix potential null-pointer dereference
Browse files Browse the repository at this point in the history
`update_metrics()` in `bpm.c` is checking for null pointer arguments,
and there was a very minor chance of dereferencing a null-pointer in
the logged message. Correct the logic to prevent this from happening.
  • Loading branch information
lexano-ivs authored and RytoEX committed Feb 14, 2025
1 parent 80ea1b1 commit 64cb68a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion shared/bpm/bpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ static void render_metrics_time(struct metrics_time *m_time)
static bool update_metrics(obs_output_t *output, const struct encoder_packet *pkt,
const struct encoder_packet_time *ept, struct metrics_data *m_track)
{
if (!output || !pkt || !ept || !m_track) {
if (!pkt) {
blog(LOG_DEBUG, "%s: Null encoder_packet pointer", __FUNCTION__);
return false;
}

if (!output || !ept || !m_track) {
blog(LOG_DEBUG, "%s: Null arguments for track %lu", __FUNCTION__, pkt->track_idx);
return false;
}
Expand Down

0 comments on commit 64cb68a

Please sign in to comment.