Skip to content

Commit a1bb00e

Browse files
committed
Fix a "use before limits check" issue
This issue was reported by cppcheck. We should be doing the limit check before reading at the offset or we may at some point try to read off the end of the array, potentially causing a segfault.
1 parent 02f8352 commit a1bb00e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mythtv/libs/libmythtv/cc708decoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ static void parse_cc_packet(CC708Reader* cb_cbs, CaptionPacket* pkt,
626626

627627
assert(pkt_size<127);
628628

629-
while (pkt_buf[off] && off<pkt_size)
629+
while (off < pkt_size && pkt_buf[off])
630630
{ // service_block
631631
int block_size = pkt_buf[off] & 0x1f;
632632
service_number = (pkt_buf[off]>>5) & 0x7;

0 commit comments

Comments
 (0)