[x265] [PATCH] Patch for issue #422 - Credit to Dimitry Andric
praveen at multicorewareinc.com
praveen at multicorewareinc.com
Thu Aug 16 14:57:49 CEST 2018
# HG changeset patch
# User Praveen Tiwari <praveen at multicorewareinc.com>
# Date 1534424221 -19800
# Thu Aug 16 18:27:01 2018 +0530
# Node ID 88ee12651e3031dc1fc2f3f6a8bbac5f67839579
# Parent cbc24109c1c849c027b5f087c6ff5f2087cb7301
Patch for issue #422 - Credit to Dimitry Andric.
This is due to undefined behavior in cuTreeFix8Pack(), where a double
value is cast directly to uint16_t. If the double value is negative,
the resulting value from the cast is undefined.
diff -r cbc24109c1c8 -r 88ee12651e30 source/common/pixel.cpp
--- a/source/common/pixel.cpp Tue Aug 14 18:01:51 2018 +0530
+++ b/source/common/pixel.cpp Thu Aug 16 18:27:01 2018 +0530
@@ -922,7 +922,7 @@
static void cuTreeFix8Pack(uint16_t *dst, double *src, int count)
{
for (int i = 0; i < count; i++)
- dst[i] = (uint16_t)(src[i] * 256.0);
+ dst[i] = (uint16_t)(int16_t)(src[i] * 256.0);
}
static void cuTreeFix8Unpack(double *dst, uint16_t *src, int count)
More information about the x265-devel
mailing list