1
0
mirror of https://github.com/golang/go synced 2024-11-18 20:04:52 -07:00

image/jpeg: reject invalid Ta and Td values.

Fixes #8693.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/141470043
This commit is contained in:
Nigel Tao 2014-09-15 08:41:59 +10:00
parent d889f5f01e
commit 8e77a7ef6b

View File

@ -65,7 +65,13 @@ func (d *decoder) processSOS(n int) error {
}
scan[i].compIndex = uint8(compIndex)
scan[i].td = d.tmp[2+2*i] >> 4
if scan[i].td > maxTh {
return FormatError("bad Td value")
}
scan[i].ta = d.tmp[2+2*i] & 0x0f
if scan[i].ta > maxTh {
return FormatError("bad Ta value")
}
}
// zigStart and zigEnd are the spectral selection bounds.