Skip to content

Commit 0ba941e

Browse files
author
Amrit kumar Mahto
committed
ts: prevent heap buffer overflow in Teletext demux path
1 parent a9413a2 commit 0ba941e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib_ccx/ts_functions.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,13 @@ int copy_capbuf_demux_data(struct ccx_demuxer *ctx, struct demuxer_data **data,
568568

569569
if (cinfo->codec == CCX_CODEC_TELETEXT)
570570
{
571+
if (cinfo->capbuflen > BUFSIZE - ptr->len)
572+
{
573+
fatal(CCX_COMMON_EXIT_BUG_BUG,
574+
"Teletext packet (%ld) larger than remaining buffer (%lld).\n",
575+
cinfo->capbuflen, BUFSIZE - ptr->len);
576+
}
577+
571578
memcpy(ptr->buffer + ptr->len, cinfo->capbuf, cinfo->capbuflen);
572579
ptr->len += cinfo->capbuflen;
573580
return CCX_OK;

0 commit comments

Comments
 (0)