You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
image/jpeg: misleading comment on maximum t value on receiveExtend() #81128
In current git repo (go1.27), the comment on huffman.go:receiveExtend() is the following:
// receiveExtend is the composition of RECEIVE and EXTEND, specified in section
// F.2.2.1.
//
// It returns the signed integer that's encoded in t bits, where t < 16. The
// possible return values are:
//
// - t == 0: 0
// - t == 1: -1, +1
// - t == 2: -3, -2, +2, +3
// - t == 3: -7, -6, -5, -4, +4, +5, +6, +7
// - ...
// - t == 15: -32767, -32766, ..., -16384, +16384, ..., +32766, +32767
But in scan.go:249, the DC path only rejects value > 16, so value == 16 is explicitly allowed.
That value is passed directly to receiveExtend in scan.go:251.
So the comment should indicate t <= 16 instead, and add
changed the title [-]image/jpeg: misleading comment on receiveExtend[/-][+]image/jpeg: misleading comment on maximum t value on receiveExtend()[/+]on Aug 26, 2026
Activity
[-]image/jpeg: misleading comment on receiveExtend[/-][+]image/jpeg: misleading comment on maximum t value on receiveExtend()[/+]prattmic commentedon Sep 4, 2026
cc @nigeltao
gopherbot commentedon Oct 7, 2026
Change https://go.dev/cl/846305 mentions this issue:
image/jpeg: reject DC difference category 16