summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Mates <jeremy.mates@gmail.com>2021-05-14 11:34:42 -0400
committerAdam Jackson <ajax@redhat.com>2021-05-14 11:34:42 -0400
commite0adae1b8e19f9bedc4cb1a3798736812cb490a6 (patch)
treee18e6f01a744d1267d2415986757ca23ecebe252
parentf0b589b685cc3d9f684d9423250f798a8f93142f (diff)
bitmap: Fix a crash with underspecified dimensions
From the reporter on #xorg-devel: -!- thrig [thrig@unaffilaited/thrig] has joined #xorg-devel <thrig> where does the code for bitmap live? there's a crash (or who knows on some platforms) if you `bitmap -size 42`
-rw-r--r--Bitmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Bitmap.c b/Bitmap.c
index e168876..d074058 100644
--- a/Bitmap.c
+++ b/Bitmap.c
@@ -963,12 +963,14 @@ BWParseSize(String size, Dimension *width, Dimension *height)
status = XParseGeometry(size, &x, &y, &w, &h);
- if (status & (WidthValue | HeightValue)) {
+ if (status & WidthValue) {
*width = (Dimension) w;
- *height = (Dimension) h;
- return True;
+ if (status & HeightValue) {
+ *height = (Dimension) h;
+ return True;
+ }
}
- else return False;
+ return False;
}