summaryrefslogtreecommitdiffstats
path: root/libxrdp
diff options
context:
space:
mode:
authorPavel Roskin <plroskin@gmail.com>2016-12-14 09:05:19 -0800
committerPavel Roskin <plroskin@gmail.com>2016-12-14 22:35:08 -0800
commit380729e9822d560182aee2cb2e66d13e9ff0e7f8 (patch)
treea6ab925564e0d97eea584de933417b96bdb70fcf /libxrdp
parent4462d22bf16f17a1561b529a5970cbf93d4a9458 (diff)
downloadxrdp-proprietary-380729e9822d560182aee2cb2e66d13e9ff0e7f8.tar.gz
xrdp-proprietary-380729e9822d560182aee2cb2e66d13e9ff0e7f8.zip
Fix a warning in jpeg compression code with --enable-jpeg
If the image width is not divisible by 4, the image is padded to the next multiple of 4. The additional pixels are filled with the colors of the last pixel in the row. The last pixel colors may not be initialized if the width is 0. In this case, the would be no padding, but the compiler doesn't know that. Add a check that the width is more that 0 before filling the padding.
Diffstat (limited to 'libxrdp')
-rw-r--r--libxrdp/xrdp_jpeg_compress.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libxrdp/xrdp_jpeg_compress.c b/libxrdp/xrdp_jpeg_compress.c
index 385203a6..755c20bd 100644
--- a/libxrdp/xrdp_jpeg_compress.c
+++ b/libxrdp/xrdp_jpeg_compress.c
@@ -365,11 +365,14 @@ jpeg_compress(char *in_data, int width, int height,
*(dst8++) = red;
}
- for (i = 0; i < e; i++)
+ if (width > 0)
{
- *(dst8++) = blue;
- *(dst8++) = green;
- *(dst8++) = red;
+ for (i = 0; i < e; i++)
+ {
+ *(dst8++) = blue;
+ *(dst8++) = green;
+ *(dst8++) = red;
+ }
}
}
}