av7110: wrong limiter in av7110_start_feed()
Subsystems (2)
PATCH 1/1 av7110: wrong limiter in av7110_start_feed()
Smatch complains that the wrong limiter is used here:drivers/media/dvb/ttpci/av7110.c +906 dvb_feed_start_pid(12)
error: buffer overflow 'npids' 5 <= 19
Here is the problem code:
905 i = dvbdmxfeed->pes_type;
906 npids[i] = (pid[i]&0x8000) ? 0 : pid[i];
"npids" is a 5 element array declared on the stack. If dvbdmxfeed->pes_type is more than 4 we probably put a (u16)0 past the end of the array.
If dvbdmxfeed->pes_type is over 4 the rest of the function doesn't do anything. dvbdmxfeed->pes_type is capped at less than DMX_TS_PES_OTHER (20) in the caller function, but I changed it to less than or equal to DMX_TS_PES_PCR (4).
drivers/media/dvb/ttpci/av7110.c +1 -1
@@ -991,7 +991,7 @@ static int av7110_start_feed(struct dvb_demux_feed *feed)if (feed->type =DMX_TYPE_TS ) {if ((feed->ts_type &TS_DECODER ) && - (feed->pes_type <DMX_TS_PES_OTHER )) { + (feed->pes_type <=DMX_TS_PES_PCR )) {switch (demux->dmx.frontend->source) {case DMX_MEMORY_FE :if (feed->ts_type &TS_DECODER )
Quoted 33 lines · On Tuesday 18 October 2011 08:12:09 Dan Carpenter wrote:
Smatch complains that the wrong limiter is used here:
drivers/media/dvb/ttpci/av7110.c+906dvb_feed_start_pid(12)
error: buffer overflow 'npids' 5 <= 19Here is the problem code:
905 i = dvbdmxfeed->pes_type; 906 npids[i] = (pid[i]&0x8000) ? 0 : pid[i];"npids" is a 5 element array declared on the stack. If
dvbdmxfeed->pes_typeis more than 4 we probably put a (u16)0 past the end of the array.If
dvbdmxfeed->pes_typeis over 4 the rest of the function doesn't do anything.dvbdmxfeed->pes_typeis capped at less thanDMX_TS_PES_OTHER(20) in the caller function, but I changed it to less than or equal toDMX_TS_PES_PCR(4).Signed-off-by Dan Carpenter <[email protected]>drivers/media/dvb/ttpci/av7110.c +1
-2@@ -991,7 +991,7 @@ static int av7110_start_feed(struct dvb_demux_feed *feed)if (feed->type =DMX_TYPE_TS ) {if ((feed->ts_type &TS_DECODER ) && - (feed->pes_type <DMX_TS_PES_OTHER )) { + (feed->pes_type <=DMX_TS_PES_PCR )) {switch (demux->dmx.frontend->source) {case DMX_MEMORY_FE :if (feed->ts_type &TS_DECODER ) --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
---------------------------------------------------------------- VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/ 4 MByte Mod: http://www.escape-edv.de/endriss/dvb-mem-mod/ Full-TS Mod: http://www.escape-edv.de/endriss/dvb-full-ts-mod/ ----------------------------------------------------------------