lel, branch HEAD
Farbfeld image viewer
cbc30c2bf4a8942b1bddebb51b8fa640840ea8d2
2024-02-15T07:03:31Z
2024-02-15T17:23:19Z
fix multiplication overflow
NRK
nrk@disroot.org
commit cbc30c2bf4a8942b1bddebb51b8fa640840ea8d2
parent 315842241bfb79a764962c2ed86f24db2a5a3946
Author: NRK <nrk@disroot.org>
Date: Thu, 15 Feb 2024 07:03:31 +0000
fix multiplication overflow
there are lots of places where width/height are being
multiplied, avoid loading images where such multiplications
would overflow. to reproduce:
[lel master]~> gcc -g3 -std=c99 -Wall -pedantic -DVERSION=\"0.2\" lel.c -fsanitize=address,undefined -o lel -lX11
[lel master]~> printf "farbfeld\x00\xff\xff\xff\x00\xff\xff\xff" | ./lel
lel.c:114:37: runtime error: signed integer overflow: 16777215 * 16777215 cannot be represented in type 'int'
315842241bfb79a764962c2ed86f24db2a5a3946
2024-02-15T06:48:40Z
2024-02-15T17:23:19Z
fix width/height loading
NRK
nrk@disroot.org
commit 315842241bfb79a764962c2ed86f24db2a5a3946
parent c34f9949c648ba8fe0ca7e2230a3bb72ced5810b
Author: NRK <nrk@disroot.org>
Date: Thu, 15 Feb 2024 06:48:40 +0000
fix width/height loading
- shift by 24 places might overflow INT_MAX (uint8_t gets
promoted to `int` due to integer promotion rules). cast to
uint32_t to fix. to reproduce:
[lel]~> gcc -g3 -std=c99 -Wall -pedantic -DVERSION=\"0.2\" lel.c -fsanitize=address,undefined -o lel -lX11
[lel]~> printf "farbfeld\xff\xff\xff\xff\xff\xff\xff\xff" | ./lel
lel.c:110:80: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
lel.c:111:83: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
- the width and height would be broken on big-endian systems
because they are being loaded as little-endian (via the
shift-or construct) and then being fed to ntohl(). this works
on little-endian systems since ntohl does a byte swap but on
big-endian systems ntohl() is a no-op and will leave the
integer at wrong state.
fix by just shifting the proper byte into the right place to
begin with: https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html?m=1
c34f9949c648ba8fe0ca7e2230a3bb72ced5810b
2020-01-28T21:33:18Z
2020-01-28T21:33:18Z
fix url in README
Hiltjo Posthuma
hiltjo@codemadness.org
commit c34f9949c648ba8fe0ca7e2230a3bb72ced5810b
parent f23db99aa948721f34fad5810809336f5b696853
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 28 Jan 2020 22:33:18 +0100
fix url in README
f23db99aa948721f34fad5810809336f5b696853
2018-01-31T16:50:02Z
2018-01-31T16:50:02Z
bump to 0.2
Hiltjo Posthuma
hiltjo@codemadness.org
commit f23db99aa948721f34fad5810809336f5b696853
parent 1233fc8d4638af920a3544ddd0f51e68235db602
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 31 Jan 2018 17:50:02 +0100
bump to 0.2
1233fc8d4638af920a3544ddd0f51e68235db602
2017-02-25T18:48:15Z
2017-02-25T18:48:15Z
revert 427120811c034a11e20b665e8a0b2b0ad6b3149b
Hiltjo Posthuma
hiltjo@codemadness.org
commit 1233fc8d4638af920a3544ddd0f51e68235db602
parent 427120811c034a11e20b665e8a0b2b0ad6b3149b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 25 Feb 2017 19:48:15 +0100
revert 427120811c034a11e20b665e8a0b2b0ad6b3149b
not sure about the previous fix, scaling would be incorrect then too.
427120811c034a11e20b665e8a0b2b0ad6b3149b
2017-02-25T18:25:48Z
2017-02-25T18:25:48Z
fix issue of allocating too little memory sometimes
Hiltjo Posthuma
hiltjo@codemadness.org
commit 427120811c034a11e20b665e8a0b2b0ad6b3149b
parent 1c42ab6acadcd9ca7e67d43c0d8f5861a06b970d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 25 Feb 2017 19:25:48 +0100
fix issue of allocating too little memory sometimes
Xlib requires additional padding per scanline sometimes, add this padding space
to ensure we have enough memory allocated.
1c42ab6acadcd9ca7e67d43c0d8f5861a06b970d
2016-07-27T17:14:15Z
2016-07-27T17:14:15Z
remove LICENSE from lel.1 header, add Svyatoslav Mishyn <juef@openmailbox.org> to LICENSE file
Hiltjo Posthuma
hiltjo@codemadness.org
commit 1c42ab6acadcd9ca7e67d43c0d8f5861a06b970d
parent b2dacdc146fad38706b29b984d86de173a189483
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 27 Jul 2016 19:14:15 +0200
remove LICENSE from lel.1 header, add Svyatoslav Mishyn <juef@openmailbox.org> to LICENSE file
+ some minor cleanup.
b2dacdc146fad38706b29b984d86de173a189483
2016-07-26T20:15:05Z
2016-07-27T16:44:29Z
rewrite lel.1
Svyatoslav Mishyn
juef@openmailbox.org
commit b2dacdc146fad38706b29b984d86de173a189483
parent 4aae420a8f5d8010d5f68b1db93b6f4c877f73da
Author: Svyatoslav Mishyn <juef@openmailbox.org>
Date: Tue, 26 Jul 2016 23:15:05 +0300
rewrite lel.1
4aae420a8f5d8010d5f68b1db93b6f4c877f73da
2016-07-26T17:31:13Z
2016-07-27T16:44:29Z
lel-open: update extension (if => ff)
Svyatoslav Mishyn
juef@openmailbox.org
commit 4aae420a8f5d8010d5f68b1db93b6f4c877f73da
parent 9dc3cfac9de524538f535a6dd343b41ed53b7014
Author: Svyatoslav Mishyn <juef@openmailbox.org>
Date: Tue, 26 Jul 2016 20:31:13 +0300
lel-open: update extension (if => ff)
9dc3cfac9de524538f535a6dd343b41ed53b7014
2016-07-26T17:24:21Z
2016-07-27T16:44:29Z
add .xz to lel-open
Svyatoslav Mishyn
juef@openmailbox.org
commit 9dc3cfac9de524538f535a6dd343b41ed53b7014
parent d5c9d0a28038fc1735977d54d649dee2f187f9a1
Author: Svyatoslav Mishyn <juef@openmailbox.org>
Date: Tue, 26 Jul 2016 20:24:21 +0300
add .xz to lel-open
d5c9d0a28038fc1735977d54d649dee2f187f9a1
2016-02-22T15:19:27Z
2016-02-22T15:19:27Z
farbfeld now lives at suckless.org, fix URL
sin
sin@2f30.org
commit d5c9d0a28038fc1735977d54d649dee2f187f9a1
parent f9b01e3336ee9ea5a7a3b19177f606785e376eb0
Author: sin <sin@2f30.org>
Date: Mon, 22 Feb 2016 15:19:27 +0000
farbfeld now lives at suckless.org, fix URL
f9b01e3336ee9ea5a7a3b19177f606785e376eb0
2015-11-17T20:51:34Z
2015-11-17T20:51:34Z
lel-open: use farbfeld tools (gif and jpg support coming soon)
Hiltjo Posthuma
hiltjo@codemadness.org
commit f9b01e3336ee9ea5a7a3b19177f606785e376eb0
parent 58c06eae1520cb251c1e7f70cdea5d90746c0384
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 17 Nov 2015 21:51:34 +0100
lel-open: use farbfeld tools (gif and jpg support coming soon)
58c06eae1520cb251c1e7f70cdea5d90746c0384
2015-11-17T20:41:55Z
2015-11-17T20:41:55Z
update README
Hiltjo Posthuma
hiltjo@codemadness.org
commit 58c06eae1520cb251c1e7f70cdea5d90746c0384
parent d5f736e3365aebd860212276645acb0d3ecf0397
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 17 Nov 2015 21:41:55 +0100
update README
d5f736e3365aebd860212276645acb0d3ecf0397
2015-11-17T20:40:25Z
2015-11-17T20:40:25Z
code-style improvements, update TODO
Hiltjo Posthuma
hiltjo@codemadness.org
commit d5f736e3365aebd860212276645acb0d3ecf0397
parent 65db024af95f0a902567907dbeb3628c819f9baf
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 17 Nov 2015 21:40:25 +0100
code-style improvements, update TODO
65db024af95f0a902567907dbeb3628c819f9baf
2015-11-17T20:34:34Z
2015-11-17T20:34:34Z
initial farbfeld support, kudos to z3bra!
Hiltjo Posthuma
hiltjo@codemadness.org
commit 65db024af95f0a902567907dbeb3628c819f9baf
parent 6ad84540f1b6baec45bcb45c392773dc254e290e
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 17 Nov 2015 21:34:34 +0100
initial farbfeld support, kudos to z3bra!
6ad84540f1b6baec45bcb45c392773dc254e290e
2015-11-17T20:32:08Z
2015-11-17T20:32:08Z
config.mk: introduce X11LIB and X11INC, makes porting simpler
Hiltjo Posthuma
hiltjo@codemadness.org
commit 6ad84540f1b6baec45bcb45c392773dc254e290e
parent c9c96132f710460f1fa37f443ea8f70f4709af26
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 17 Nov 2015 21:32:08 +0100
config.mk: introduce X11LIB and X11INC, makes porting simpler
c9c96132f710460f1fa37f443ea8f70f4709af26
2014-08-02T23:56:55Z
2014-08-02T23:56:55Z
update TODO
Hiltjo Posthuma
hiltjo@codemadness.org
commit c9c96132f710460f1fa37f443ea8f70f4709af26
parent ab9cbe037f3c83444be66af5531f2f4bc61cb0c4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 2 Aug 2014 23:56:55 +0000
update TODO
ab9cbe037f3c83444be66af5531f2f4bc61cb0c4
2014-08-02T23:53:54Z
2014-08-02T23:53:54Z
add alpha blending...
Hiltjo Posthuma
hiltjo@codemadness.org
commit ab9cbe037f3c83444be66af5531f2f4bc61cb0c4
parent 77d29cab890dd1623b96d445cf0b898ff8c09df8
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 2 Aug 2014 23:53:54 +0000
add alpha blending...
... and add configurable background colour.
77d29cab890dd1623b96d445cf0b898ff8c09df8
2014-08-02T11:50:30Z
2014-08-02T14:02:52Z
Fix error messages
sin
sin@2f30.org
commit 77d29cab890dd1623b96d445cf0b898ff8c09df8
parent 731fb4699a844e3ed77a32ea768e0969f95aee07
Author: sin <sin@2f30.org>
Date: Sat, 2 Aug 2014 12:50:30 +0100
Fix error messages
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
731fb4699a844e3ed77a32ea768e0969f95aee07
2014-08-02T11:47:42Z
2014-08-02T14:02:48Z
Staticise functions
sin
sin@2f30.org
commit 731fb4699a844e3ed77a32ea768e0969f95aee07
parent 2aff7e58cc521e0110de44743b35e54cb3480b94
Author: sin <sin@2f30.org>
Date: Sat, 2 Aug 2014 12:47:42 +0100
Staticise functions
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2aff7e58cc521e0110de44743b35e54cb3480b94
2014-08-02T00:33:12Z
2014-08-02T00:33:12Z
add .bz2 and .gz to lel-open
Hiltjo Posthuma
hiltjo@codemadness.org
commit 2aff7e58cc521e0110de44743b35e54cb3480b94
parent f5218c3944254bcfcb184de6ffff153fc4e61956
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 2 Aug 2014 00:33:12 +0000
add .bz2 and .gz to lel-open
f5218c3944254bcfcb184de6ffff153fc4e61956
2014-08-02T00:20:40Z
2014-08-02T00:20:40Z
print name to stdout on enter
Hiltjo Posthuma
hiltjo@codemadness.org
commit f5218c3944254bcfcb184de6ffff153fc4e61956
parent be0f93f92b7b36856acb9709b9ee550b89899db6
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 2 Aug 2014 00:20:40 +0000
print name to stdout on enter
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
be0f93f92b7b36856acb9709b9ee550b89899db6
2014-08-01T23:34:41Z
2014-08-01T23:34:41Z
add TODO item
Hiltjo Posthuma
hiltjo@codemadness.org
commit be0f93f92b7b36856acb9709b9ee550b89899db6
parent 59520ad6cb2f48f6299d08d20c6112cd419314b3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 1 Aug 2014 23:34:41 +0000
add TODO item
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
59520ad6cb2f48f6299d08d20c6112cd419314b3
2014-08-01T21:35:58Z
2014-08-01T23:34:23Z
Update README
sin
sin@2f30.org
commit 59520ad6cb2f48f6299d08d20c6112cd419314b3
parent 8b3fe011a0d4ba50db81184ece2b85a2bb28269f
Author: sin <sin@2f30.org>
Date: Fri, 1 Aug 2014 22:35:58 +0100
Update README
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
8b3fe011a0d4ba50db81184ece2b85a2bb28269f
2014-08-01T23:26:11Z
2014-08-01T23:26:11Z
add reqwinwidth, reqwinheight for request
Hiltjo Posthuma
hiltjo@codemadness.org
commit 8b3fe011a0d4ba50db81184ece2b85a2bb28269f
parent 569ab289e66572fcc16959f1f8c55f7d82b17085
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 1 Aug 2014 23:26:11 +0000
add reqwinwidth, reqwinheight for request
use winwidth and winheight for the actual given size. This fixes image
cycling with different dimensions in a tiling layout.
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
569ab289e66572fcc16959f1f8c55f7d82b17085
2014-08-01T21:22:00Z
2014-08-01T23:20:31Z
Fix normalsize()
sin
sin@2f30.org
commit 569ab289e66572fcc16959f1f8c55f7d82b17085
parent 049c5f73a2b1174d54d033e10bd5d34373f77884
Author: sin <sin@2f30.org>
Date: Fri, 1 Aug 2014 22:22:00 +0100
Fix normalsize()
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
049c5f73a2b1174d54d033e10bd5d34373f77884
2014-08-01T18:06:32Z
2014-08-01T23:00:47Z
Add primitive support for multiple images
sin
sin@2f30.org
commit 049c5f73a2b1174d54d033e10bd5d34373f77884
parent 0bcb47ab3451309490d3f4a856b755ea43ff282e
Author: sin <sin@2f30.org>
Date: Fri, 1 Aug 2014 19:06:32 +0100
Add primitive support for multiple images
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
0bcb47ab3451309490d3f4a856b755ea43ff282e
2014-08-01T22:33:45Z
2014-08-01T22:33:45Z
initial repo
Hiltjo Posthuma
hiltjo@codemadness.org
commit 0bcb47ab3451309490d3f4a856b755ea43ff282e
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 1 Aug 2014 22:33:45 +0000
initial repo
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>