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

Can't open tiny (<16 byte) image files #614

Closed
DavidBuchanan314 opened this issue Jun 21, 2021 · 0 comments · Fixed by #615
Closed

Can't open tiny (<16 byte) image files #614

DavidBuchanan314 opened this issue Jun 21, 2021 · 0 comments · Fixed by #615

Comments

@DavidBuchanan314
Copy link
Contributor

DavidBuchanan314 commented Jun 21, 2021

The feh_is_image function asserts that the file is at least 16 bytes long:

feh/src/imlib.c

Lines 256 to 259 in bc372c8

if (fread(buf, 1, 16, fh) != 16) {
fclose(fh);
return 0;
}

An example of such a tiny (15 byte) file is as follows (an 8x8 PBM bitmap):

P4
8 8
AAAAAAA

(note, there are 7 A's, the 8th byte of bitmap data is the trailing newline)

The file should look like this, when viewed in GIMP (or other viewer):

image

Imagemagick can also handle it as an input file.

Padding the file with zeroes, up to 16 bytes, allows feh to open the file correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant