diff options
| author | Pengpeng Hou <pengpeng@iscas.ac.cn> | 2026-06-30 15:19:33 +0800 |
|---|---|---|
| committer | Hans Verkuil <hverkuil+cisco@kernel.org> | 2026-07-15 17:12:55 +0200 |
| commit | f373cf17fb8e7a530bc6e1e36fc41cb5dab2cdaa (patch) | |
| tree | a27459415deb5802fe13626433451c97f36d9ee3 | |
| parent | bf533acaaa7dee21d49bcaabf8e813ea36bddcd8 (diff) | |
| download | linux-f373cf17fb8e7a530bc6e1e36fc41cb5dab2cdaa.tar.gz linux-f373cf17fb8e7a530bc6e1e36fc41cb5dab2cdaa.zip | |
media: ivtv: stop VBI start-code scan before short tail
compress_sliced_buf() scans one byte at a time while testing a four-byte
VBI start code. The final iterations can read beyond the remaining
buffer tail.
Stop the scan once fewer than four bytes remain.
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
| -rw-r--r-- | drivers/media/pci/ivtv/ivtv-vbi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/pci/ivtv/ivtv-vbi.c b/drivers/media/pci/ivtv/ivtv-vbi.c index ae7a00f46257..af086c4cbe1a 100644 --- a/drivers/media/pci/ivtv/ivtv-vbi.c +++ b/drivers/media/pci/ivtv/ivtv-vbi.c @@ -330,7 +330,7 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8 unsigned lines = 0; /* find the first valid line */ - for (i = 0; i < size; i++, buf++) { + for (i = 0; i + 3 < size; i++, buf++) { if (buf[0] == 0xff && !buf[1] && !buf[2] && buf[3] == sav) break; } |
