Skip to content

Commit

Permalink
add casting of bitfield values to avoid crash
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Apr 26, 2024
1 parent 2170229 commit 9233c4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/fmt/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,11 @@ static int vhprintf(const char *fmt, va_list ap, re_vprintf_h *vph, void *arg,
out:
#ifndef RELEASE
if (err == ENODATA) {
DEBUG_WARNING("Format: \"%b<-- NO ARG\n", fmt, p - fmt + 1);
re_fprintf(stderr, "Format: \"%b<-- NO ARG\n", fmt, p - fmt + 1);
re_assert(0 && "RE_VA_ARG: no more arguments");
}
if (err == EOVERFLOW) {
DEBUG_WARNING("Format: \"%b<-- SIZE ERROR\n", fmt,
re_fprintf(stderr, "Format: \"%b<-- SIZE ERROR\n", fmt,
p - fmt + 1);
re_assert(0 && "RE_VA_ARG: arg is not compatible");
}
Expand Down
12 changes: 6 additions & 6 deletions src/rtp/rtcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ int rtcp_msg_print(struct re_printf *pf, const struct rtcp_msg *msg)
if (!msg)
return 0;

err = re_hprintf(pf, "%8s pad=%d count=%-2d pt=%-3d len=%u ",
err = re_hprintf(pf, "%8s pad=%u count=%-2u pt=%-3u len=%u ",
rtcp_type_name((enum rtcp_type)msg->hdr.pt),
msg->hdr.p,
msg->hdr.count, msg->hdr.pt, msg->hdr.length);
(unsigned)msg->hdr.p,
(unsigned)msg->hdr.count, (unsigned)msg->hdr.pt, msg->hdr.length);
if (err)
return err;

Expand All @@ -222,7 +222,7 @@ int rtcp_msg_print(struct re_printf *pf, const struct rtcp_msg *msg)
for (i=0; i<msg->hdr.count && !err; i++) {
const struct rtcp_rr *rr = &msg->r.sr.rrv[i];
err = re_hprintf(pf, " {%08x %u %d %u %u %u %u}",
rr->ssrc, rr->fraction, rr->lost,
rr->ssrc, rr->fraction, (int)rr->lost,
rr->last_seq, rr->jitter,
rr->lsr, rr->dlsr);
}
Expand All @@ -233,7 +233,7 @@ int rtcp_msg_print(struct re_printf *pf, const struct rtcp_msg *msg)
for (i=0; i<msg->hdr.count && !err; i++) {
const struct rtcp_rr *rr = &msg->r.rr.rrv[i];
err = re_hprintf(pf, " {0x%08x %u %d %u %u %u %u}",
rr->ssrc, rr->fraction, rr->lost,
rr->ssrc, rr->fraction, (int)rr->lost,
rr->last_seq, rr->jitter,
rr->lsr, rr->dlsr);
}
Expand All @@ -258,7 +258,7 @@ int rtcp_msg_print(struct re_printf *pf, const struct rtcp_msg *msg)
break;

case RTCP_BYE:
err = re_hprintf(pf, "%u srcs:", msg->hdr.count);
err = re_hprintf(pf, "%u srcs:", (unsigned)msg->hdr.count);
for (i=0; i<msg->hdr.count && !err; i++) {
err = re_hprintf(pf, " %08x",
msg->r.bye.srcv[i]);
Expand Down

0 comments on commit 9233c4a

Please sign in to comment.