Skip to content

Commit 3eb84c8

Browse files
committed
image/jpeg: reject bad Tq values in SOF data.
Fixes golang#10154 Change-Id: Ibb8ea9bcf512e7639c57a6f17afbe4495fa329cd Reviewed-on: https://go-review.googlesource.com/7494 Reviewed-by: Minux Ma <minux@golang.org>
1 parent f076ad8 commit 3eb84c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/image/jpeg/reader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ func (d *decoder) processSOF(n int) error {
331331
}
332332

333333
d.comp[i].tq = d.tmp[8+3*i]
334+
if d.comp[i].tq > maxTq {
335+
return FormatError("bad Tq value")
336+
}
337+
334338
hv := d.tmp[7+3*i]
335339
h, v := int(hv>>4), int(hv&0x0f)
336340
if h < 1 || 4 < h || v < 1 || 4 < v {

0 commit comments

Comments
 (0)