mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-02 20:35:37 +02:00
avformat/sccenc: avoid potential invalid access
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
parent
4607868b98
commit
8e828ee1ad
@ -72,11 +72,11 @@ static int scc_write_packet(AVFormatContext *avf, AVPacket *pkt)
|
|||||||
s = (int)(pts / 1000) % 60;
|
s = (int)(pts / 1000) % 60;
|
||||||
f = (int)(pts % 1000) / 33;
|
f = (int)(pts % 1000) / 33;
|
||||||
|
|
||||||
for (i = 0; i < pkt->size; i+=3) {
|
for (i = 0; i < pkt->size - 2; i+=3) {
|
||||||
if (pkt->data[i] == 0xfc && ((pkt->data[i + 1] != 0x80 || pkt->data[i + 2] != 0x80)))
|
if (pkt->data[i] == 0xfc && ((pkt->data[i + 1] != 0x80 || pkt->data[i + 2] != 0x80)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i >= pkt->size)
|
if (i >= pkt->size - 2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!scc->inside && (scc->prev_h != h || scc->prev_m != m || scc->prev_s != s || scc->prev_f != f)) {
|
if (!scc->inside && (scc->prev_h != h || scc->prev_m != m || scc->prev_s != s || scc->prev_f != f)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user