summaryrefslogtreecommitdiff
path: root/src/pkg/image/jpeg/huffman.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/image/jpeg/huffman.go')
-rw-r--r--src/pkg/image/jpeg/huffman.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/image/jpeg/huffman.go b/src/pkg/image/jpeg/huffman.go
index 9b731fdc4..f53d873a5 100644
--- a/src/pkg/image/jpeg/huffman.go
+++ b/src/pkg/image/jpeg/huffman.go
@@ -37,6 +37,9 @@ func (d *decoder) ensureNBits(n int) error {
for d.b.n < n {
c, err := d.r.ReadByte()
if err != nil {
+ if err == io.EOF {
+ return FormatError("short Huffman data")
+ }
return err
}
d.b.a = d.b.a<<8 | uint32(c)
@@ -50,6 +53,9 @@ func (d *decoder) ensureNBits(n int) error {
if c == 0xff {
c, err = d.r.ReadByte()
if err != nil {
+ if err == io.EOF {
+ return FormatError("short Huffman data")
+ }
return err
}
if c != 0x00 {