Mercurial > libavformat.hg
changeset 675:29a19aec26b2 libavformat
Writing to freed memory in write_section_data() patch by (Wolfram Gloger <wmglo dent dot med dot uni-muenchen de>)
author | michael |
---|---|
date | Wed, 16 Feb 2005 23:04:11 +0000 |
parents | b2ee9f2492d7 |
children | 8512c400e3bc |
files | mpegts.c |
diffstat | 1 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegts.c Wed Feb 09 03:00:50 2005 +0000 +++ b/mpegts.c Wed Feb 16 23:04:11 2005 +0000 @@ -116,7 +116,6 @@ { MpegTSSectionFilter *tss = &tss1->u.section_filter; int len; - unsigned int crc; if (is_start) { memcpy(tss->section_buf, buf, buf_size); @@ -142,14 +141,10 @@ } if (tss->section_h_size != -1 && tss->section_index >= tss->section_h_size) { - if (tss->check_crc) { - crc = mpegts_crc32(tss->section_buf, tss->section_h_size); - if (crc != 0) - goto invalid_crc; - } - tss->section_cb(tss->opaque, tss->section_buf, tss->section_h_size); - invalid_crc: tss->end_of_section_reached = 1; + if (!tss->check_crc || + mpegts_crc32(tss->section_buf, tss->section_h_size) == 0) + tss->section_cb(tss->opaque, tss->section_buf, tss->section_h_size); } } @@ -926,9 +921,12 @@ if (p + len > p_end) return; if (len && cc_ok) { - /* write remaning section bytes */ + /* write remaining section bytes */ write_section_data(s, tss, p, len, 0); + /* check whether filter has been closed */ + if (!ts->pids[pid]) + return; } p += len; if (p < p_end) {