openh264 icon indicating copy to clipboard operation
openh264 copied to clipboard

Using unititialized value in unittest.

Open ethanhugg opened this issue 12 years ago • 0 comments

Valgrind is reporting a dependence on an unititialized value in encoder_ext.cpp. I believe it is the value being returned from WelsMbToSliceIdc which references pSliceCtx->pOverallMbMap which may not have been initialized.

Valgrind runs pretty easily on Linux if you want to try yourself. I used this command line: valgrind --leak-check=full ./codec_unittest

encoder_ext.cpp:566: bLeft = (pList[iIdx].iMbX > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iLeftXY)); bTop = (pList[iIdx].iMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iTopXY)); bLeftTop = (pList[iIdx].iMbX > 0) && (pList[iIdx].iMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iLeftTopXY)); bRightTop = (pList[iIdx].iMbX < (iMbWidth - 1)) && (pList[iIdx].iMbY > 0) && (uiSliceIdc == WelsMbToSliceIdc (pSliceCtx, iRightTopXY));

-- Relevant Valgrind Output: [ RUN ] EncodeFile/EncoderOutputTest.CompareOutput/6 ==7509== Conditional jump or move depends on uninitialised value(s) ==7509== at 0x59DE48: WelsSVCEnc::InitMbInfo(WelsSVCEnc::TagWelsEncCtx_, WelsSVCEnc::TagMB_, WelsSVCEnc::TagDqLayer_, int, int) (encoder_ext.cpp:566) ==7509== by 0x59E366: WelsSVCEnc::InitMbListD(WelsSVCEnc::TagWelsEncCtx__) (encoder_ext.cpp:632) ==7509== by 0x5A181D: WelsSVCEnc::RequestMemorySvc(WelsSVCEnc::TagWelsEncCtx__) (encoder_ext.cpp:1445) ==7509== by 0x5A30D1: WelsSVCEnc::WelsInitEncoderExt(WelsSVCEnc::TagWelsEncCtx__, WelsSVCEnc::TagWelsSvcCodingParam_) (encoder_ext.cpp:1988) ==7509== by 0x599EEA: WelsSVCEnc::CWelsH264SVCEncoder::InitializeInternal(WelsSVCEnc::TagWelsSvcCodingParam_) (welsEncoderExt.cpp:374) ==7509== by 0x599847: WelsSVCEnc::CWelsH264SVCEncoder::InitializeExt(TagEncParamExt const_) (welsEncoderExt.cpp:225) ==7509== by 0x52663B: InitWithParam(ISVCEncoder_, EUsageType, int, int, float, SliceModeEnum, bool, int) (BaseEncoderTest.cpp:52) ==7509== by 0x526999: BaseEncoderTest::EncodeStream(InputStream_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:73) ==7509== by 0x5271F9: BaseEncoderTest::EncodeFile(char const_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:109) ==7509== by 0x535419: EncoderOutputTest_CompareOutput_Test::TestBody() (encoder_test.cpp:60) ==7509== by 0x55DF29: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::)(), char const) (gtest.cc:2078) ==7509== by 0x5590CB: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::)(), char const) (gtest.cc:2114) ==7509== ==7509== Conditional jump or move depends on uninitialised value(s) ==7509== at 0x59DE8C: WelsSVCEnc::InitMbInfo(WelsSVCEnc::TagWelsEncCtx_, WelsSVCEnc::TagMB_, WelsSVCEnc::TagDqLayer_, int, int) (encoder_ext.cpp:567) ==7509== by 0x59E366: WelsSVCEnc::InitMbListD(WelsSVCEnc::TagWelsEncCtx**) (encoder_ext.cpp:632) ==7509== by 0x5A181D: WelsSVCEnc::RequestMemorySvc(WelsSVCEnc::TagWelsEncCtx**) (encoder_ext.cpp:1445) ==7509== by 0x5A30D1: WelsSVCEnc::WelsInitEncoderExt(WelsSVCEnc::TagWelsEncCtx**, WelsSVCEnc::TagWelsSvcCodingParam_) (encoder_ext.cpp:1988) ==7509== by 0x599EEA: WelsSVCEnc::CWelsH264SVCEncoder::InitializeInternal(WelsSVCEnc::TagWelsSvcCodingParam_) (welsEncoderExt.cpp:374) ==7509== by 0x599847: WelsSVCEnc::CWelsH264SVCEncoder::InitializeExt(TagEncParamExt const_) (welsEncoderExt.cpp:225) ==7509== by 0x52663B: InitWithParam(ISVCEncoder_, EUsageType, int, int, float, SliceModeEnum, bool, int) (BaseEncoderTest.cpp:52) ==7509== by 0x526999: BaseEncoderTest::EncodeStream(InputStream_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:73) ==7509== by 0x5271F9: BaseEncoderTest::EncodeFile(char const_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:109) ==7509== by 0x535419: EncoderOutputTest_CompareOutput_Test::TestBody() (encoder_test.cpp:60) ==7509== by 0x55DF29: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::)(), char const) (gtest.cc:2078) ==7509== by 0x5590CB: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::)(), char const) (gtest.cc:2114) ==7509== ==7509== Conditional jump or move depends on uninitialised value(s) ==7509== at 0x59DF52: WelsSVCEnc::InitMbInfo(WelsSVCEnc::TagWelsEncCtx_, WelsSVCEnc::TagMB_, WelsSVCEnc::TagDqLayer*, int, int) (encoder_ext.cpp:570) ==7509== by 0x59E366: WelsSVCEnc::InitMbListD(WelsSVCEnc::TagWelsEncCtx**) (encoder_ext.cpp:632) ==7509== by 0x5A181D: WelsSVCEnc::RequestMemorySvc(WelsSVCEnc::TagWelsEncCtx**) (encoder_ext.cpp:1445) ==7509== by 0x5A30D1: WelsSVCEnc::WelsInitEncoderExt(WelsSVCEnc::TagWelsEncCtx**, WelsSVCEnc::TagWelsSvcCodingParam_) (encoder_ext.cpp:1988) ==7509== by 0x599EEA: WelsSVCEnc::CWelsH264SVCEncoder::InitializeInternal(WelsSVCEnc::TagWelsSvcCodingParam_) (welsEncoderExt.cpp:374) ==7509== by 0x599847: WelsSVCEnc::CWelsH264SVCEncoder::InitializeExt(TagEncParamExt const_) (welsEncoderExt.cpp:225) ==7509== by 0x52663B: InitWithParam(ISVCEncoder_, EUsageType, int, int, float, SliceModeEnum, bool, int) (BaseEncoderTest.cpp:52) ==7509== by 0x526999: BaseEncoderTest::EncodeStream(InputStream_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:73) ==7509== by 0x5271F9: BaseEncoderTest::EncodeFile(char const_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:109) ==7509== by 0x535419: EncoderOutputTest_CompareOutput_Test::TestBody() (encoder_test.cpp:60) ==7509== by 0x55DF29: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::)(), char const) (gtest.cc:2078) ==7509== by 0x5590CB: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::)(), char const) (gtest.cc:2114) ==7509== ==7509== Conditional jump or move depends on uninitialised value(s) ==7509== at 0x59DEEC: WelsSVCEnc::InitMbInfo(WelsSVCEnc::TagWelsEncCtx_, WelsSVCEnc::TagMB_, WelsSVCEnc::TagDqLayer_, int, int) (encoder_ext.cpp:568) ==7509== by 0x59E366: WelsSVCEnc::InitMbListD(WelsSVCEnc::TagWelsEncCtx__) (encoder_ext.cpp:632) ==7509== by 0x5A181D: WelsSVCEnc::RequestMemorySvc(WelsSVCEnc::TagWelsEncCtx__) (encoder_ext.cpp:1445) ==7509== by 0x5A30D1: WelsSVCEnc::WelsInitEncoderExt(WelsSVCEnc::TagWelsEncCtx__, WelsSVCEnc::TagWelsSvcCodingParam_) (encoder_ext.cpp:1988) ==7509== by 0x599EEA: WelsSVCEnc::CWelsH264SVCEncoder::InitializeInternal(WelsSVCEnc::TagWelsSvcCodingParam_) (welsEncoderExt.cpp:374) ==7509== by 0x599847: WelsSVCEnc::CWelsH264SVCEncoder::InitializeExt(TagEncParamExt const_) (welsEncoderExt.cpp:225) ==7509== by 0x52663B: InitWithParam(ISVCEncoder_, EUsageType, int, int, float, SliceModeEnum, bool, int) (BaseEncoderTest.cpp:52) ==7509== by 0x526999: BaseEncoderTest::EncodeStream(InputStream_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:73) ==7509== by 0x5271F9: BaseEncoderTest::EncodeFile(char const_, EUsageType, int, int, float, SliceModeEnum, bool, int, BaseEncoderTest::Callback_) (BaseEncoderTest.cpp:109) ==7509== by 0x535419: EncoderOutputTest_CompareOutput_Test::TestBody() (encoder_test.cpp:60) ==7509== by 0x55DF29: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::)(), char const) (gtest.cc:2078) ==7509== by 0x5590CB: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test_, void (testing::Test::_)(), char const*) (gtest.cc:2114) ==7509==

ethanhugg avatar Jun 10 '14 22:06 ethanhugg