From 5f19a9f89d6aedd233e7d81b6297791e224a75f6 Mon Sep 17 00:00:00 2001 From: grave-w-grave Date: Wed, 4 Jan 2017 12:38:39 +1100 Subject: [PATCH] Skip the packet if the adaptation field length is broken --- src/lib_ccx/ts_tables.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib_ccx/ts_tables.c b/src/lib_ccx/ts_tables.c index 2a77a63a..0b555c20 100644 --- a/src/lib_ccx/ts_tables.c +++ b/src/lib_ccx/ts_tables.c @@ -485,6 +485,13 @@ void ts_buffer_psi_packet(struct ccx_demuxer *ctx) ctx->PID_buffers[pid]->prev_ccounter=0xff; } + //skip the packet if the adaptation field legnth or payload length are out of bounds or broken + if (adaptation_field_length > 184 || payload_length > 184) { + payload_length = 0; + dbg_print(CCX_DMT_GENERIC_NOTICES, "\rWarning: Bad packet, adaptation field too long, skipping.\n"); + + } + if(payload_start_indicator) { if(ctx->PID_buffers[pid]->ccounter>0)