google-code-export / camlistore

Automatically exported from code.google.com/p/camlistore
Apache License 2.0
0 stars 0 forks source link

images: decode leaves im in nil state when needRescale and factor == 1 #513

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In images.decode, it is possible for needRescale to be true and factor to be 1. 
This means that im is never filled from mr.

Tha attached jpeg will reproduce this - though only when when camput to a 
remote camliserver (devcam and localhost servers do not exhibit this bug as far 
as I can see).

Original issue reported on code.google.com by dan.kort...@adelaide.edu.au on 7 Sep 2014 at 1:10

Attachments:

GoogleCodeExporter commented 9 years ago
2014/09/07 12:55:53 Received blob 
[sha1-c59ef0cadddd24f84d1ff36946472664b9a17a72; 16478 bytes]
2014/09/07 12:55:53 filename "bug.jpeg" exif = 2011-11-17 17:21:04 +0000 UTC, 
<nil>
2014/09/07 12:55:54 Received blob 
[sha1-9e0573de75dfcfc12634c848ddca2c7a4ac225de; 358 bytes]
2014/09/07 12:55:54 Received blob 
[sha1-db8b0662cf73451cc0bcf768f38ec769bbb5fd07; 576 bytes]
2014/09/07 12:55:54 Received blob 
[sha1-e45f9212002150157a5fac9be9ee48a6ad2bd98c; 750 bytes]
2014/09/07 12:56:03 http: panic serving 192.168.1.7:37198: runtime error: 
invalid memory address or nil pointer dereference
goroutine 147 [running]:
net/http.func·011()
    /home/daniel/Development/go/src/pkg/net/http/server.go:1100 +0xb7
runtime.panic(0xcd9640, 0x1523953)
    /home/daniel/Development/go/src/pkg/runtime/panic.c:248 +0x18d
camlistore.org/pkg/images.rescale(0x0, 0x0, 0x100, 0x100, 0x0, 0x0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/images/images.go:279 +0x4d
camlistore.org/pkg/images.decode(0x7f2838e01a08, 0xc20813c680, 0xc208e8fd40, 
0x7f2838e01a00, 0x0, 0x0, 0xda59f0, 0x4, 0x0, 0x0, ...)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/images/images.go:441 +0x966
camlistore.org/pkg/images.Decode(0x7f2838e01a08, 0xc20813c0e0, 0xc208e8fd40, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/images/images.go:527 +0x3c1
camlistore.org/pkg/server.(*ImageHandler).scaleImage(0xc208692dc0, 
0x7f2838df25d0, 0xc208743ae0, 0x0, 0x0, 0x0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/server/image.go:261 +0x399
camlistore.org/pkg/server.func·002(0x0, 0x0, 0x0, 0x0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/server/image.go:343 +0x5a
camlistore.org/pkg/singleflight.(*Group).Do(0x152d960, 0xc208692e60, 0x41, 
0xc2089a7710, 0x0, 0x0, 0x0, 0x0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/singleflight/singleflight.go:56 +0x21f
camlistore.org/pkg/server.(*ImageHandler).ServeHTTP(0xc208692dc0, 
0x7f2838e01698, 0xc20903e000, 0xc2090295f0, 0x7f2838df25d0, 0xc208743ae0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/server/image.go:344 +0x567
camlistore.org/pkg/server.(*UIHandler).serveThumbnail(0xc208029d40, 
0x7f2838e01698, 0xc20903e000, 0xc2090295f0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/server/ui.go:603 +0x3cf
camlistore.org/pkg/server.(*UIHandler).ServeHTTP(0xc208029d40, 0x7f2838e01698, 
0xc20903e000, 0xc2090295f0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/server/ui.go:443 +0x301
camlistore.org/pkg/httputil.(*PrefixHandler).ServeHTTP(0xc208104560, 
0x7f2838e01698, 0xc20903e000, 0xc2090295f0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/httputil/httputil.go:114 +0x229
camlistore.org/pkg/auth.Handler.serveHTTPForOp(0x7f2838df7e90, 0xc208104560, 
0x7f2838e01698, 0xc20903e000, 0xc2090295f0, 0x7f)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/auth/auth.go:368 +0x78
camlistore.org/pkg/auth.Handler.ServeHTTP(0x7f2838df7e90, 0xc208104560, 
0x7f2838e01698, 0xc20903e000, 0xc2090295f0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/auth/auth.go:362 +0x58
camlistore.org/pkg/auth.(*Handler).ServeHTTP(0xc208683c90, 0x7f2838e01698, 
0xc20903e000, 0xc2090295f0)
    <autogenerated>:13 +0xae
net/http.(*ServeMux).ServeHTTP(0xc2084abbc0, 0x7f2838e01698, 0xc20903e000, 
0xc2090295f0)
    /home/daniel/Development/go/src/pkg/net/http/server.go:1511 +0x1a3
camlistore.org/pkg/webserver.(*Server).ServeHTTP(0xc2084a9260, 0x7f2838e01698, 
0xc20903e000, 0xc2090295f0)
    /home/daniel/Development/src/camlistore.org/tmp/build-gopath-nosqlite/src/camlistore.org/pkg/webserver/webserver.go:122 +0x290
net/http.serverHandler.ServeHTTP(0xc2084a80c0, 0x7f2838e01698, 0xc20903e000, 
0xc2090295f0)
    /home/daniel/Development/go/src/pkg/net/http/server.go:1673 +0x19f
net/http.(*conn).serve(0xc20817ec80)
    /home/daniel/Development/go/src/pkg/net/http/server.go:1174 +0xa7e
created by net/http.(*Server).Serve
    /home/daniel/Development/go/src/pkg/net/http/server.go:1721 +0x313

Original comment by dan.kort...@adelaide.edu.au on 7 Sep 2014 at 1:29

GoogleCodeExporter commented 9 years ago
Depends on djpeg install.

Original comment by dan.kort...@adelaide.edu.au on 8 Sep 2014 at 12:15

GoogleCodeExporter commented 9 years ago
"Depends on djpeg install" are you saying that running with 
CAMLI_DISABLE_DJPEG=1 works?

If yes, my bad.  I'm not going to have time to look into a fix for a couple of 
weeks.

Just to verify, are you working with a checkout later than:

commit 4bcaaf82cca2c4279107d62d0ca2d4c0fbb940d7
Author: Bill Thiede <git@xinu.tv>
Date:   Mon Aug 11 22:19:16 2014 -0700

    images/fastjpeg: use jpeg.Decode when djpeg fails.

    Return error of type ErrDjpegFailed when djpeg or parsing the PNM returned
    fails.
    Attempt to decode image again with standard library.

    Change-Id: I2a0cb7b52885732b7cbbffb8e34993d232781bc0

Original comment by couchmo...@gmail.com on 8 Sep 2014 at 5:33

GoogleCodeExporter commented 9 years ago
Yes, CAMLI_DISABLE_DJPEG=1 prevents the problem. If you have time to look at 
https://camlistore-review.googlesource.com/#/c/3746/ where I have a fix, that 
would be helpful.

Original comment by dan.kort...@adelaide.edu.au on 8 Sep 2014 at 8:37

GoogleCodeExporter commented 9 years ago
4ac944c09c9754fa42c62751546796406485996d

Original comment by mathieu....@gmail.com on 10 Sep 2014 at 9:30

GoogleCodeExporter commented 9 years ago
This issue has moved to https://camlistore.org/issue/513

Original comment by bradfitz on 14 Dec 2014 at 11:37