Skip to content

Commit

Permalink
image/jpeg: reject bad Tq values in SOF data.
Browse files Browse the repository at this point in the history
Fixes golang#10154

Change-Id: Ibb8ea9bcf512e7639c57a6f17afbe4495fa329cd
Reviewed-on: https://go-review.googlesource.com/7494
Reviewed-by: Minux Ma <[email protected]>
  • Loading branch information
nigeltao committed Mar 13, 2015
1 parent f076ad8 commit 3eb84c8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/image/jpeg/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ func (d *decoder) processSOF(n int) error {
}

d.comp[i].tq = d.tmp[8+3*i]
if d.comp[i].tq > maxTq {
return FormatError("bad Tq value")
}

hv := d.tmp[7+3*i]
h, v := int(hv>>4), int(hv&0x0f)
if h < 1 || 4 < h || v < 1 || 4 < v {
Expand Down

0 comments on commit 3eb84c8

Please sign in to comment.