shithub: opus

Download patch

ref: d401961a1858c616fac95ffc8065539a47c3f2df
parent: de473b305c6e18587ee3c205b313e75356e3f540
author: Mark Harris <mark.hsj@gmail.com>
date: Thu Jul 21 17:22:22 EDT 2016

tests: Avoid shift into sign undefined behavior

--- a/tests/test_opus_decode.c
+++ b/tests/test_opus_decode.c
@@ -436,7 +436,7 @@
       iseed=atoi(env_seed);
       env_used=1;
    }
-   else iseed=(opus_uint32)time(NULL)^((getpid()&65535)<<16);
+   else iseed=(opus_uint32)time(NULL)^(((opus_uint32)getpid()&65535)<<16);
    Rw=Rz=iseed;
 
    oversion=opus_get_version_string();
--- a/tests/test_opus_encode.c
+++ b/tests/test_opus_encode.c
@@ -490,7 +490,7 @@
       iseed=atoi(env_seed);
       env_used=1;
    }
-   else iseed=(opus_uint32)time(NULL)^((getpid()&65535)<<16);
+   else iseed=(opus_uint32)time(NULL)^(((opus_uint32)getpid()&65535)<<16);
    Rw=Rz=iseed;
 
    oversion=opus_get_version_string();