12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- Memory sanitizer does not handle assembly code well and may generate false
- positives. libjpeg-turbo readme suggests to disable SIMD extensions at all when
- running it with sanitizers. We do not do this, but disable only some SIMD
- routines that cause problems with our tests.
- For more info see:
- * https://st.yandex-team.ru/CV-219
- * https://st.yandex-team.ru/DEVTOOLSSUPPORT-728
- * https://github.com/google/sanitizers/issues/192
- * https://github.com/libjpeg-turbo/libjpeg-turbo#memory-debugger-pitfalls
- * http://clang.llvm.org/docs/MemorySanitizer.html#handling-external-code
- --- b/jinclude.h
- +++ a/jinclude.h
- @@ -130,6 +130,10 @@
- #endif /* _WIN32 */
-
- #endif /* NO_PUTENV */
- +
- +#ifdef WITH_SANITIZER
- +# define malloc(sz) calloc((sz), 1)
- +#endif
- #endif /* JINCLUDE_H */
- --- b/simd/x86_64/jsimd.c
- +++ a/simd/x86_64/jsimd.c
- @@ -116,6 +116,7 @@ jsimd_can_ycc_rgb(void)
- {
- init_simd();
- +#ifndef WITH_SANITIZER
- /* The code is optimised for these values only */
- if (BITS_IN_JSAMPLE != 8)
- return 0;
- @@ -130,6 +131,7 @@ jsimd_can_ycc_rgb(void)
- if ((simd_support & JSIMD_SSE2) &&
- IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
- return 1;
- +#endif
- return 0;
- }
- @@ -997,6 +999,7 @@ jsimd_can_huff_encode_one_block(void)
- {
- init_simd();
- +#ifndef WITH_SANITIZER
- if (DCTSIZE != 8)
- return 0;
- if (sizeof(JCOEF) != 2)
- @@ -1005,6 +1008,7 @@ jsimd_can_huff_encode_one_block(void)
- if ((simd_support & JSIMD_SSE2) && simd_huffman &&
- IS_ALIGNED_SSE(jconst_huff_encode_one_block))
- return 1;
- +#endif
- return 0;
- }
- @@ -1023,6 +1027,7 @@ jsimd_can_encode_mcu_AC_first_prepare(void)
- {
- init_simd();
- +#ifndef WITH_SANITIZER
- if (DCTSIZE != 8)
- return 0;
- if (sizeof(JCOEF) != 2)
- @@ -1029,6 +1034,7 @@ jsimd_can_encode_mcu_AC_first_prepare(void)
- return 0;
- if (simd_support & JSIMD_SSE2)
- return 1;
- +#endif
- return 0;
- }
- @@ -1047,6 +1053,7 @@ jsimd_can_encode_mcu_AC_refine_prepare(void)
- {
- init_simd();
- +#ifndef WITH_SANITIZER
- if (DCTSIZE != 8)
- return 0;
- if (sizeof(JCOEF) != 2)
- @@ -1053,6 +1060,7 @@ jsimd_can_encode_mcu_AC_refine_prepare(void)
- return 0;
- if (simd_support & JSIMD_SSE2)
- return 1;
- +#endif
- return 0;
- }
|