Comments (11)
Looks like an issue with color indexing, see #7
Guess when github.com/RobCherry/vibrant is gone, the issue will be gone...
from photoprism.
Thanks for having a look! I tried to import only the photo that caused the segfault in a new docker instance, and the crash occurred again.
I don't know if it is of any help, but here is a link to the photo that triggers this bug http://lithops.se/IMG_20170425_062158425.jpg (Original, ~10 MB large)
from photoprism.
@lastzero , @gmelchett
I tested @gmelchett 's image on vibrant library.
And I figured out the following issue of go image library that some special jpg cannot decode.
golang/go#10447
reproducing
wget http://lithops.se/IMG_20170425_062158425.jpg -O sample.jpg
and following code runs, then it can be output invalid JPEG format: short Huffman data
package main
import (
"fmt"
"image"
_ "image/jpeg" // "net/http"
"os"
"github.com/RobCherry/vibrant"
)
func main() {
file, _ := os.Open("sample.jpg")
decodedImage, _, err := image.Decode(file)
if err != nil {
fmt.Println(err)
}
palette := vibrant.NewPaletteBuilder(decodedImage).Generate()
fmt.Println(palette)
}
result:
$go run main.go
invalid JPEG format: short Huffman data
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x10c8329]
goroutine 1 [running]:
github.com/RobCherry/vibrant.NewPaletteBuilder(0x0, 0x0, 0x1)
/Users/yugo-horie/go/src/github.com/RobCherry/vibrant/palette.go:202 +0x29
main.main()
/Users/yugo-horie/vibrant_test/main.go:26 +0xc7
exit status 2
But also I think it's better to be handling those errors properly.
from photoprism.
Would https://github.com/disintegration/imaging also be affected? This is what we're using for resizing etc...
from photoprism.
I checked github.com/disintegration/imaging is affected because
image.Decode
is called by imaging.Open(m.filename, imaging.AutoOrientation(true))
in your code.
i.e.
photoprism/internal/photoprism/thumbnails.go
Line 103 in 6844c5f
but it maynot cause segfalt if you care failed safe the error that is catches next statements.
from photoprism.
So ultimately that means we need to replace "image/jpeg" or we can not import certain images as the issue was closed by the golang team. Any opinions / alternatives?
from photoprism.
Looking at golang/go/issues/10447 it looks like the cause could be that the image is truncated, and indeed my photo is truncated. In Firefox (62), the bottom lines are white, while in Gimp (2.10) only the down right corner isn't correct.
The photos is taken by a Qualcomm based mobile phone with stock Android. (Moto X Force)
from photoprism.
So ignoring it would be OK until we find a better solution?
from photoprism.
Yes, it would be OK. However, it would be nice it photoprism didn't crash upon such images. Ignoring them would be prefered, maybe copy/move these faulty images to a special folder with faulty images?
from photoprism.
Of course it shouldn't crash later, but for now this is what we want. Fail fast. Otherwise, nobody would have complained and it might not have gotten any attention. Now we know there is a problem.
from photoprism.
Think we can close this.
from photoprism.
Related Issues (20)
- MariaDB: Problems with invalid Unicode characters on a custom instance running on WSL2 HOT 8
- Videos: Support for HTTP Live Streaming (HLS) with M3U8 HOT 1
- Videos: Support workers (like Peertube runners) for distributed transcoding
- Videos: Upgrade FFmpeg to v7.x for faster transcoding and extended file format support
- Only first "Person in Image" is added to People tab when import photo with exif metadata HOT 1
- Places: Include videos in the map-based place browser (the 'Places' view) HOT 2
- Indexing: (Re)index selected photos/videos HOT 1
- Correct thumbnails, after clicking on them the wrong photo is displayed (for some photos) HOT 2
- Metadata: Don't ignore stop words when generating titles from file names HOT 2
- Photoprism gives space error and refused to start
- PhotoSync App Password HOT 1
- UX: Support timeline feature HOT 2
- Image Import seems to ignore visually similar image with different SHA1sums. HOT 2
- Portainer stack setup does not work if you change PHOTOPRISM_DATABASE_PASSWORD from "insecure" to anything else. HOT 1
- Orientation operation, returned error 500 HOT 4
- Search: Enable Title-Based Sorting HOT 3
- New face can't be named – Entity not found HOT 11
- Sharing: Add names to the secret token of the link HOT 1
- Cannot create apps and services HOT 2
- MariaDB binay logs growing more than 1GB per hour after upgrading to Build 240420-ef5f14bc4 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from photoprism.