Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Some pngs give error error decoding image: image: unknown format #2340

Closed
mirabilos opened this issue Nov 7, 2023 · 7 comments · Fixed by #2391
Closed

[bug] Some pngs give error error decoding image: image: unknown format #2340

mirabilos opened this issue Nov 7, 2023 · 7 comments · Fixed by #2391
Labels
bug Something isn't working

Comments

@mirabilos
Copy link
Contributor

Describe the bug with a clear and concise description of what the bug is.

I was just looking at logs and:

timestamp="2023-11-07T04:43:39.068Z" func=dereferencing.(*deref).enrichAccount level=ERROR requestID=jzfhfa4b04000c030v60 msg="error fetching remote avatar for account https://social.handlerug.me/users/handlerug: fetchRemoteAccountAvatar: error loading attachment https://social.handlerug.me/fileserver/01QP5CG9VADMWT4Q08PW6CCYX3/attachment/original/01EANG35MK1P379GGQ8CA0XPJB.png: finish: error decoding image: image: unknown format"

Well… file(1) knows it as…

01EANG35MK1P379GGQ8CA0XPJB.png: PNG image data, 256 x 256, 8-bit/color RGB, non-interlaced

… and xloadimage displays it just fine.

What's your GoToSocial Version?

0.12.1 git-5fdc005

GoToSocial Arch

amd64 binary

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Anything else we need to know?

No response

@mirabilos mirabilos added the bug Something isn't working label Nov 7, 2023
@tsmethurst
Copy link
Contributor

tsmethurst commented Nov 7, 2023

Ah interesting, yep I can replicate it on latest snapshot. Looks like an issue with the library we use for detecting file formats.

EDIT: actually it looks like the error is coming from Go's image package...

EDIT2: or the file is not being put into storage at all, which is why it can't be decoded afterwards, I'll have to poke at this

@tsmethurst
Copy link
Contributor

Ah interesting, I tried downloading the image to my own computer from that instance, then uploading it as a media attachment on a locally-running GtS instance, and I get the same error...

@mirabilos
Copy link
Contributor Author

mirabilos commented Nov 7, 2023 via email

@tsmethurst
Copy link
Contributor

I also had a video today that wouldn’t show up but was viewable from
the remote instance; should I hunt that down so you have more examples
of misdetected media?

No that's fine, thanks. We've already got a fix for that sort of issue in the works.

@tsmethurst tsmethurst changed the title [bug] png is an unknown image type‽ [bug] Some pngs give error error decoding image: image: unknown format Nov 8, 2023
@tsmethurst
Copy link
Contributor

Bit more of a writeup on this after looking at it a bit more:

The reason it returns unknown format error during finish is because it's trying to decode an image of 0 bytes.

In other words: the png was not stored, but nor did writing 0 bytes into storage return any errors.

I think the reason it's not being stored is because exif terminator is overzealously terminating the entire image as it's being streamed into storage. I'll have to do a bit more investigation of this to determine why that is the case. Doesn't make a lot of sense for it to do that, so I'm assuming it's a bug either in exif terminator, or in the png structure library that exif terminator depends on.

@tsmethurst
Copy link
Contributor

https://github.com/superseriousbusiness/exif-terminator/issues/5

@tsmethurst
Copy link
Contributor

Got a fix for this in the works now: superseriousbusiness/exif-terminator#6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants