jungle0755 / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

memory read failure in I411 #525

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

Error #1: UNINITIALIZED READ: reading 0x0163cfd8-0x0163cfda 2 byte(s) within 
0x0163cfd6-0x0163cfda
#0 I411ToARGBRow_SSSE3                                                        
[d:\src\libyuv\libyuv\source\row_win.cc:2829]
#1 I411ToARGB                                                                 
[d:\src\libyuv\libyuv\source\convert_argb.cc:549]
#2 libyuv::LibYUVConvertTest_I411ToARGB_Any_Test::TestBody                    
[d:\src\libyuv\libyuv\unit_test\convert_test.cc:510]
#3 testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,void> 
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2458]
#4 testing::Test::Run                                                         
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2475]
#5 testing::TestInfo::Run                                                     
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2656]
#6 testing::TestCase::Run                                                     
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2774]
#7 testing::internal::UnitTestImpl::RunAllTests                               
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:4647]
#8 
testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTe
stImpl,bool> [d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2458]
#9 testing::UnitTest::Run                                                     
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:4258]
#10 RUN_ALL_TESTS                                                              
[d:\src\libyuv\libyuv\testing\gtest\include\gtest\gtest.h:2237]
#11 main                                                                       
[d:\src\libyuv\libyuv\unit_test\unit_test.cc:355]
Note: @0:03:04.380 in thread 7220
Note: instruction: pinsrw (%esi) $0x00 -> %xmm0

Original issue reported on code.google.com by fbarch...@chromium.org on 17 Nov 2015 at 8:32

GoogleCodeExporter commented 8 years ago

Original comment by fbarch...@chromium.org on 17 Nov 2015 at 10:16

GoogleCodeExporter commented 8 years ago
This code fails:

// Read 2 UV from 411, upsample to 8 UV.
#define READYUV411 __asm {                                                     \
    __asm pinsrw     xmm0, [esi], 0        /* U */                             \
    __asm pinsrw     xmm1, [esi + edi], 0  /* V */                             \
    __asm lea        esi,  [esi + 2]                                           \
    __asm punpcklbw  xmm0, xmm1            /* UV */                            \
    __asm punpcklwd  xmm0, xmm0            /* UVUV (upsample) */               \
    __asm punpckldq  xmm0, xmm0            /* UVUVUVUV (upsample) */           \
    __asm movq       xmm4, qword ptr [eax]                                     \
    __asm punpcklbw  xmm4, xmm4                                                \
    __asm lea        eax, [eax + 8]                                            \
  }

Original comment by fbarch...@chromium.org on 17 Nov 2015 at 11:12

GoogleCodeExporter commented 8 years ago
To reproduce the issue:

set GYP_DEFINES=build_for_tool=drmemory target_arch=ia32
python build\gyp_chromium -fninja -G msvs_version=2013 --depth=. libyuv_test.gyp
ninja -C out\Release
drmemory out\debug\libyuv_unittest.exe --gtest_catch_exceptions=0 
--gtest_filter=*I411ToARGB_Opt

Original comment by fbarch...@chromium.org on 17 Nov 2015 at 11:29

GoogleCodeExporter commented 8 years ago
The following revision refers to this bug:
  https://chromium.googlesource.com/libyuv/libyuv.git/+/5eefbe2330868cc7c913346e0a72111c93c245f9

commit 5eefbe2330868cc7c913346e0a72111c93c245f9
Author: Frank Barchard <fbarchard@google.com>
Date: Wed Nov 18 02:00:52 2015

Fix for drmemory failure on I411ToARGB

Before
I420ToARGB_Opt (594 ms)
I422ToARGB_Opt (483 ms)
I411ToARGB_Opt (748 ms) ***
I444ToARGB_Opt (452 ms)
I400ToARGB_Opt (218 ms)

After
I420ToARGB_Opt (591 ms)
I422ToARGB_Opt (454 ms)
I411ToARGB_Opt (502 ms)  ***
I444ToARGB_Opt (441 ms)
I400ToARGB_Opt (216 ms)

TBR=harryjin@google.com
BUG=libyuv:525

Review URL: https://codereview.chromium.org/1459513002 .

[modify] 
http://crrev.com/5eefbe2330868cc7c913346e0a72111c93c245f9/README.chromium
[modify] 
http://crrev.com/5eefbe2330868cc7c913346e0a72111c93c245f9/include/libyuv/version
.h
[modify] 
http://crrev.com/5eefbe2330868cc7c913346e0a72111c93c245f9/source/row_win.cc
[modify] 
http://crrev.com/5eefbe2330868cc7c913346e0a72111c93c245f9/unit_test/convert_test
.cc

Original comment by bugdroid1@chromium.org on 18 Nov 2015 at 2:01

GoogleCodeExporter commented 8 years ago
Fixed for Windows.  TODO gcc version
gcc version can be tested on Windows with drmemory using llvm 64 bit build.

Original comment by fbarch...@chromium.org on 18 Nov 2015 at 2:09

GoogleCodeExporter commented 8 years ago
Updating to drmemory 1.9 the failure goes away

c:\src\libyuv2\libyuv>drmemory out\debug\libyuv_unittest.exe 
--gtest_catch_exceptions=0 --gtest_filter=*I411ToARGB_Opt
~~Dr.M~~ Dr. Memory version 1.9.0
~~Dr.M~~ Running "out\debug\libyuv_unittest.exe --gtest_catch_exceptions=0 
--gtest_filter=*I411ToARGB_Opt"
Note: Google Test filter = *I411ToARGB_Opt
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from LibYUVConvertTest
[ RUN      ] LibYUVConvertTest.I411ToARGB_Opt
[       OK ] LibYUVConvertTest.I411ToARGB_Opt (901 ms)
[----------] 1 test from LibYUVConvertTest (945 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1367 ms total)
[  PASSED  ] 1 test.
~~Dr.M~~
~~Dr.M~~ NO ERRORS FOUND:
~~Dr.M~~       0 unique,     0 total unaddressable access(es)
~~Dr.M~~       0 unique,     0 total uninitialized access(es)
~~Dr.M~~       0 unique,     0 total invalid heap argument(s)
~~Dr.M~~       0 unique,     0 total GDI usage error(s)
~~Dr.M~~       0 unique,     0 total handle leak(s)
~~Dr.M~~       0 unique,     0 total warning(s)
~~Dr.M~~       0 unique,     0 total,      0 byte(s) of leak(s)
~~Dr.M~~       0 unique,     0 total,      0 byte(s) of possible leak(s)
~~Dr.M~~ ERRORS IGNORED:
~~Dr.M~~      10 potential leak(s) (suspected false positives)
~~Dr.M~~          (details: C:\Users\fbarchard\AppData\Roaming\Dr. 
Memory\DrMemory-libyuv_unittest.exe.10124.000\potential_errors.txt)
~~Dr.M~~     140 unique,   213 total,  12674 byte(s) of still-reachable 
allocation(s)
~~Dr.M~~          (re-run with "-show_reachable" for details)
~~Dr.M~~ Details: C:\Users\fbarchard\AppData\Roaming\Dr. 
Memory\DrMemory-libyuv_unittest.exe.10124.000\results.txt

Original comment by fbarch...@chromium.org on 18 Nov 2015 at 2:39

GoogleCodeExporter commented 8 years ago
The following revision refers to this bug:
  https://chromium.googlesource.com/libyuv/libyuv.git/+/50f8cb2db33f563b290a2831b3aecbf357a44e32

commit 50f8cb2db33f563b290a2831b3aecbf357a44e32
Author: Frank Barchard <fbarchard@google.com>
Date: Wed Nov 18 21:05:39 2015

port I411 movzx 2 byte reader to gcc

previously the I411 format used movd to read U, V pixels.
But this reads 4 bytes, and can cause a memory exception.
pinsrw can be used, but fails on drmemory 1.5, and is slow.
So in this change a movzxw is used to read 2 bytes into EBX,
then copy to xmm0 with movd.
Slightly slower, but no memory exception
Was LibYUVConvertTest.I411ToARGB_Opt (577 ms)
Now LibYUVConvertTest.I411ToARGB_Opt (608 ms)

TBR=harryjin@google.com
BUG=libyuv:525

Review URL: https://codereview.chromium.org/1457783004 .

[modify] 
http://crrev.com/50f8cb2db33f563b290a2831b3aecbf357a44e32/README.chromium
[modify] 
http://crrev.com/50f8cb2db33f563b290a2831b3aecbf357a44e32/include/libyuv/version
.h
[modify] 
http://crrev.com/50f8cb2db33f563b290a2831b3aecbf357a44e32/source/row_gcc.cc

Original comment by bugdroid1@chromium.org on 18 Nov 2015 at 9:06

GoogleCodeExporter commented 8 years ago
bot failure 
[2/12] CXX obj/unit_test/libyuv_unittest.cpu_test.o
[3/12] CXX obj/unit_test/libyuv_unittest.version_test.o
[4/12] CXX obj/util/compare.compare.o
[5/12] CC obj/util/cpuid.cpuid.o
FAILED: /Volumes/data/b/build/goma/gomacc 
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF 
obj/source/libyuv.row_gcc.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 
-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DCHROMIUM_BUILD 
-DCR_CLANG_REVISION=247874-1 -DCOMPONENT_BUILD -DUSE_LIBJPEG_TURBO=1 
-DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_WEBRTC=1 
-DENABLE_MEDIA_ROUTER=1 -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY 
-DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 
-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA 
-DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 
-DENABLE_PDF=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 
-DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 
-DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DENABLE_PRINTING=1 
-DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 
-DUSE_BROWSER_SPELLCHECKER=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 
-DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 
-DENABLE_SERVICE_DISCOVERY=1 -DENABLE_WIFI_BOOTSTRAPPING=1 
-DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD 
-DSAFE_BROWSING_DB_LOCAL -DHAVE_JPEG -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DDYNAMIC_ANNOTATIONS_ENABLED=1 
-DWTF_USE_DYNAMIC_ANNOTATIONS=1 -Igen -I../../include -I../.. 
-I../../chromium/src/third_party/libjpeg_turbo -isysroot 
/Applications/Xcode6.1.app/Contents/Developer/Platforms/MacOSX.platform/Develope
r/SDKs/MacOSX10.10.sdk -O0 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof 
-mmacosx-version-min=10.6 -arch i386 -Wall -Wendif-labels -Wextra 
-Wno-unused-parameter -Wno-missing-field-initializers 
-Wno-selector-type-mismatch -Wpartial-availability -Wheader-hygiene 
-Wno-char-subscripts -Wno-unneeded-internal-declaration 
-Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing 
-Wno-deprecated-register -Wno-inconsistent-missing-override 
-Wno-shift-negative-value -Wno-bitfield-width -std=c++11 -stdlib=libc++ 
-fno-rtti -fno-exceptions -fvisibility-inlines-hidden -fno-threadsafe-statics 
-Xclang -load -Xclang 
/Volumes/data/b/build/slave/mac32/build/src/third_party/llvm-build/Release+Asser
ts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang 
find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang 
check-templates -fcolor-diagnostics -fno-strict-aliasing -fstack-protector-all 
-Wno-undefined-bool-conversion -Wno-tautological-undefined-compare  -c 
../../source/row_gcc.cc -o obj/source/libyuv.row_gcc.o
../../source/row_gcc.cc:1807:5: error: inline assembly requires more registers 
than available
    "sub       %[u_buf],%[v_buf]               \n"
    ^
../../source/row_gcc.cc:1807:5: error: inline assembly requires more registers 
than available
2 errors generated.
ninja: build stopped: subcommand failed.

Original comment by fbarch...@google.com on 19 Nov 2015 at 4:04

GoogleCodeExporter commented 8 years ago
The following revision refers to this bug:
  https://chromium.googlesource.com/libyuv/libyuv.git/+/b7dfb72559f902c3af7fee0dee109076e66380b6

commit b7dfb72559f902c3af7fee0dee109076e66380b6
Author: Frank Barchard <fbarchard@google.com>
Date: Thu Nov 19 09:45:14 2015

fix for I411 build error on 32 bit x86

TBR=harrjin@google.com
BUG=libyuv:525

Review URL: https://codereview.chromium.org/1461693004 .

[modify] 
http://crrev.com/b7dfb72559f902c3af7fee0dee109076e66380b6/README.chromium
[modify] 
http://crrev.com/b7dfb72559f902c3af7fee0dee109076e66380b6/include/libyuv/version
.h
[modify] 
http://crrev.com/b7dfb72559f902c3af7fee0dee109076e66380b6/source/row_gcc.cc

Original comment by bugdroid1@chromium.org on 19 Nov 2015 at 9:46

GoogleCodeExporter commented 8 years ago
Fixed in r1544

Original comment by fbarch...@chromium.org on 19 Nov 2015 at 8:30