From e0adae1b8e19f9bedc4cb1a3798736812cb490a6 Mon Sep 17 00:00:00 2001 From: Jeremy Mates Date: Fri, 14 May 2021 11:34:42 -0400 Subject: bitmap: Fix a crash with underspecified dimensions From the reporter on #xorg-devel: -!- thrig [thrig@unaffilaited/thrig] has joined #xorg-devel where does the code for bitmap live? there's a crash (or who knows on some platforms) if you `bitmap -size 42` --- Bitmap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Bitmap.c') 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; } -- cgit v1.2.3