[x265] [PATCH] primitives: ensure x265_cpu_cpuid() clears eax even when built without asm

Steve Borho steve at borho.org
Wed Mar 4 14:20:21 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1425475207 21600
#      Wed Mar 04 07:20:07 2015 -0600
# Node ID f767e4fd1b086d32d1d9736a87e361508d3358c0
# Parent  9382f8869cd3796dfe3595ee7d70e0b02d17ef1d
primitives: ensure x265_cpu_cpuid() clears eax even when built without asm

valgrind found this error condition; when built without assembly cpu detection
was using an uninitialized variable.

diff -r 9382f8869cd3 -r f767e4fd1b08 source/common/primitives.cpp
--- a/source/common/primitives.cpp	Wed Mar 04 07:11:02 2015 -0600
+++ b/source/common/primitives.cpp	Wed Mar 04 07:20:07 2015 -0600
@@ -258,7 +258,7 @@
 extern "C" {
 int x265_cpu_cpuid_test(void) { return 0; }
 void x265_cpu_emms(void) {}
-void x265_cpu_cpuid(uint32_t, uint32_t *, uint32_t *, uint32_t *, uint32_t *) {}
+void x265_cpu_cpuid(uint32_t, uint32_t *eax, uint32_t *, uint32_t *, uint32_t *) { *eax = 0; }
 void x265_cpu_xgetbv(uint32_t, uint32_t *, uint32_t *) {}
 }
 #endif


More information about the x265-devel mailing list