masterofeye / libyuv

Automatically exported from code.google.com/p/libyuv
0 stars 0 forks source link

DrMemory fail YUY2ToNV12_Opt with LIBYUV_WIDTH=123 #545

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
set LIBYUV_WIDTH=123
drmemory out\debug\libyuv_unittest.exe --gtest_catch_exceptions=0 
--gtest_filter=*YUY2ToNV12*

Dr. Memory version 1.9.0 build 4 built on Oct  2 2015 13:13:14
Dr. Memory results for pid 9164: "libyuv_unittest.exe"
Application cmdline: "out\debug\libyuv_unittest.exe --gtest_catch_exceptions=0 
--gtest_filter=*"
Recorded 116 suppression(s) from default C:\Program Files (x86)\Dr. 
Memory\bin\suppress-default.txt

Error #1: UNINITIALIZED READ: reading 0x0018fd8c-0x0018fd8d 1 byte(s) within 
0x0018fd8c-0x0018fd90
#0 abs                                                                    
[f:\dd\vctools\crt\crtw32\misc\abs.c:37]
#1 libyuv::LibYUVConvertTest_YUY2ToNV12_Any_Test::TestBody                
[d:\src\libyuv\libyuv\unit_test\convert_test.cc:862]
#2 testing::internal::HandleExceptionsInMethodIfSupported<>               
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2458]
#3 testing::Test::Run                                                     
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2475]
#4 testing::TestInfo::Run                                                 
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2656]
#5 testing::TestCase::Run                                                 
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2774]
#6 testing::internal::UnitTestImpl::RunAllTests                           
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:4647]
#7 testing::internal::HandleExceptionsInMethodIfSupported<>               
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:2458]
#8 testing::UnitTest::Run                                                 
[d:\src\libyuv\libyuv\testing\gtest\src\gtest.cc:4258]
#9 RUN_ALL_TESTS                                                          
[d:\src\libyuv\libyuv\testing\gtest\include\gtest\gtest.h:2237]
#10 main                                                                   
[d:\src\libyuv\libyuv\unit_test\unit_test.cc:354]
Note: @0:03:01.492 in thread 10736
Note: instruction: cmp    0x08(%ebp) $0x00000000

Original issue reported on code.google.com by fbarch...@google.com on 12 Jan 2016 at 2:39

GoogleCodeExporter commented 8 years ago
appears this is an overwrite on Y.  In this loop:

for (y = 0; y < height - 1; y += 2) {                            
  // Split Y from UV.                                            
  SplitUVRow(src_yuy2, dst_y, rows, awidth);                     
  SplitUVRow(src_yuy2 + src_stride_yuy2, dst_y + dst_stride_y,   
             rows + awidth, awidth);                             
  InterpolateRow(dst_uv, rows, awidth, awidth, 128);             
  src_yuy2 += src_stride_yuy2 * 2;                               
  dst_y += dst_stride_y * 2;                                     
  dst_uv += dst_stride_uv;                                       
}                                                                

when width is odd, an extra Y is output.

Original comment by fbarch...@google.com on 16 Jan 2016 at 2:13

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

commit 58cb534962b86fc1b673a8f0835e98852a1754ff
Author: Frank Barchard <fbarchard@google.com>
Date: Tue Jan 19 19:28:09 2016

Fix memory overwrite in YUY2ToNV12 odd wdiths

When width was odd Y channel wrote an extra pixel.
This change splits the Y from UV into a temporary
buffer and memcpy's to the destination.  Performance
is slower.

Was
YUY2ToNV12_Any (307 ms)
YUY2ToNV12_Unaligned (213 ms)
TestYUY2ToNV12 (181 ms)
YUY2ToNV12_Opt (177 ms)
YUY2ToNV12_Invert (177 ms)

Npw
YUY2ToNV12_Any (300 ms)
YUY2ToNV12_Unaligned (226 ms)
YUY2ToNV12_Invert (206 ms)
TestYUY2ToNV12 (184 ms)
YUY2ToNV12_Opt (181 ms)
TBR=harryjin@google.com
BUG=libyuv:545

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

[modify] 
http://crrev.com/58cb534962b86fc1b673a8f0835e98852a1754ff/README.chromium
[modify] 
http://crrev.com/58cb534962b86fc1b673a8f0835e98852a1754ff/include/libyuv/version
.h
[modify] 
http://crrev.com/58cb534962b86fc1b673a8f0835e98852a1754ff/source/planar_function
s.cc
[modify] 
http://crrev.com/58cb534962b86fc1b673a8f0835e98852a1754ff/unit_test/convert_test
.cc

Original comment by bugdroid1@chromium.org on 19 Jan 2016 at 7:28

GoogleCodeExporter commented 8 years ago
Fixed in r1567

Original comment by fbarch...@google.com on 19 Jan 2016 at 10:02