Itk: Valgrind Defects related to the MedianImageFilter

Created on 7 Nov 2019  路  4Comments  路  Source: InsightSoftwareConsortium/ITK

https://open.cdash.org/viewDynamicAnalysis.php?buildid=6196748

IPW ==8471== Invalid write of size 4
==8471==    at 0x173C9A: itk::MedianImageFilter, itk::Image >::DynamicThreadedGenerateData(itk::ImageRegion<2u> const&) (itkMedianImageFilter.hxx:98)
==8471==    by 0x155DF3: itk::ImageSource >::GenerateData()::{lambda(itk::ImageRegion<2u> const&)#1}::operator()(itk::ImageRegion<2u> const&) const (itkImageSource.hxx:232)
==8471==    by 0x1680AA: std::_Function_handler const&), itk::ImageSource >::GenerateData()::{lambda(itk::ImageRegion<2u> const&)#1}>::_M_invoke(std::_Any_data const&, itk::ImageRegion<2u> const&) (std_function.h:316)
==8471==    by 0x168294: std::function const&)>::operator()(itk::ImageRegion<2u> const&) const (std_function.h:706)
==8471==    by 0x1624E0: void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::function const&)>, itk::ProcessObject*)::{lambda(long const*, unsigned long const*)#1}::operator()(long const*, unsigned long const*) const (itkMultiThreaderBase.h:300)
==8471==    by 0x16BF03: std::_Function_handler(itk::ImageRegion<2u> const&, std::function const&)>, itk::ProcessObject*)::{lambda(long const*, unsigned long const*)#1}>::_M_invoke(std::_Any_data const&, long const*&&, unsigned long const*&&) (std_function.h:316)
==8471==    by 0x50028E2: std::function::operator()(long const*, unsigned long const*) const (std_function.h:706)
==8471==    by 0x50631D4: itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::function, itk::ProcessObject*) (itkPoolMultiThreader.cxx:243)
==8471==    by 0x162607: void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::function const&)>, itk::ProcessObject*) (itkMultiThreaderBase.h:289)
==8471==    by 0x155F24: itk::ImageSource >::GenerateData() (itkImageSource.hxx:229)
==8471==    by 0x4FF102A: itk::ProcessObject::UpdateOutputData(itk::DataObject*) (itkProcessObject.cxx:1688)
==8471==    by 0x50159B5: itk::DataObject::UpdateOutputData() (itkDataObject.cxx:369)
==8471==    by 0x15B1AF: itk::ImageBase<2u>::UpdateOutputData() (itkImageBase.hxx:271)
==8471==    by 0x501562C: itk::DataObject::Update() (itkDataObject.cxx:301)
==8471==    by 0x4FEFCAF: itk::ProcessObject::Update() (itkProcessObject.cxx:1270)
==8471==    by 0x170BA2: void (anonymous namespace)::Expect_output_has_specified_pixel_values_when_input_has_sequence_of_natural_numbers >(itk::Image::RegionType const&, std::vector::PixelType, std::allocator::PixelType> > const&) (itkMedianImageFilterGTest.cxx:86)
==8471==    by 0x16FDB4: MedianImageFilter_ExpectedOutputPixelValuesForSequenceOfNaturalNumbers_Test::TestBody() (itkMedianImageFilterGTest.cxx:112)
==8471==    by 0x1A607F: void testing::internal::HandleSehExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2401)
==8471==    by 0x1A01F0: void testing::internal::HandleExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2437)
==8471==    by 0x183D79: testing::Test::Run() (gtest.cc:2473)
==8471==    by 0x1846DD: testing::TestInfo::Run() (gtest.cc:2655)
==8471==    by 0x184D70: testing::TestCase::Run() (gtest.cc:2773)
==8471==    by 0x18BE1A: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:4673)
==8471==    by 0x1A719C: bool testing::internal::HandleSehExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2401)
==8471==    by 0x1A0F7C: bool testing::internal::HandleExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2437)
==8471==    by 0x18A8F8: testing::UnitTest::Run() (gtest.cc:4281)
==8471==    by 0x1B4FDD: RUN_ALL_TESTS() (gtest.h:2237)
==8471==    by 0x1B4F6C: main (gtest_main.cc:37)
Bug

All 4 comments

Thanks Bradley @blowekamp A fix is underway 馃槃 It appears related to ImageBoundaryFacesCalculator producing an image region of zero pixels. And then it appears that Experimental::ImageRegionIndexRange does not always handle a zero-sized region correctly. Especially when the itk::Size has both zero and non-zero values.

Thanks you very much for your prompt attention.

The current page from Linux-x86_64-gcc7.3-valgrind Dynamic analysis no longer mentions MedianImageFilter. May I conclude that this issue is fixed? (Apparently pull request #1398 did it!) 馃槂 If so, please close!

Thanks for the fix!

Was this page helpful?
0 / 5 - 0 ratings