Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valgrind Defects related to the MedianImageFilter #1397

Open
blowekamp opened this issue Nov 7, 2019 · 3 comments
Assignees
Labels

Comments

@blowekamp
Copy link
Member

@blowekamp blowekamp commented Nov 7, 2019

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)
@N-Dekker

This comment has been minimized.

Copy link
Contributor

@N-Dekker N-Dekker commented Nov 7, 2019

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.

@blowekamp

This comment has been minimized.

Copy link
Member Author

@blowekamp blowekamp commented Nov 7, 2019

Thanks you very much for your prompt attention.

N-Dekker added a commit to N-Dekker/ITK that referenced this issue Nov 7, 2019
`IndexRange` did behave incorrectly when it would be constructed with an
`itk::Size` that has one or more zero values _and_ one or more non-zero
values. Specifically, in that case, the begin and the end iterator were
sometimes different, while they should compare equal. This bug caused
Valgrind defects, issue InsightSoftwareConsortium#1397, reported by Bradley @blowekamp

This bug fix ensures that a `itk::Size` that has one or more zero values
is treated the same way as a `itk::Size` that has _only_ zero values.

Fixes issue InsightSoftwareConsortium#1397 Valgrind Defects related to the MedianImageFilter
N-Dekker added a commit to N-Dekker/ITK that referenced this issue Nov 7, 2019
`IndexRange` did behave incorrectly when it would be constructed with an
`itk::Size` that has one or more zero values _and_ one or more non-zero
values. Specifically, in that case, the begin and the end iterator were
sometimes different, while they should compare equal. This bug caused
Valgrind defects, issue InsightSoftwareConsortium#1397, reported by Bradley @blowekamp

This bug fix ensures that a `itk::Size` that has one or more zero values
is treated the same way as a `itk::Size` that has _only_ zero values.

Fixes issue InsightSoftwareConsortium#1397 Valgrind Defects related to the MedianImageFilter
N-Dekker added a commit to N-Dekker/ITK that referenced this issue Nov 7, 2019
`IndexRange` did behave incorrectly when it would be constructed with an
`itk::Size` that has one or more zero values _and_ one or more non-zero
values. Specifically, in that case, the begin and the end iterator were
sometimes different, while they should compare equal. This bug caused
Valgrind defects, issue InsightSoftwareConsortium#1397, reported by Bradley @blowekamp

This bug fix ensures that a `itk::Size` that has one or more zero values
is treated the same way as a `itk::Size` that has _only_ zero values.

Fixes issue InsightSoftwareConsortium#1397 Valgrind Defects related to the MedianImageFilter
N-Dekker added a commit to N-Dekker/ITK that referenced this issue Nov 8, 2019
`IndexRange` did behave incorrectly when it would be constructed with an
`itk::Size` that has one or more zero values _and_ a non-zero value at
its last position, for example `Size<3>{{0, 0, 8}}`. Specifically, in
that case, the begin and the end iterator were sometimes different,
while they should compare equal. This bug caused Valgrind defects, issue
InsightSoftwareConsortium#1397, reported by Bradley @blowekamp

The bug affects both `IndexRange` specializations,
`ImageRegionIndexRange` and `ZeroBasedIndexRange`.

This bug fix ensures that a `itk::Size` that has one or more zero values
is treated the same way as a `itk::Size` that has _only_ zero values.

Fixes issue InsightSoftwareConsortium#1397 Valgrind Defects related to the MedianImageFilter
N-Dekker added a commit to N-Dekker/ITK that referenced this issue Nov 8, 2019
`IndexRange` did behave incorrectly when it would be constructed with an
`itk::Size` that has one or more zero values _and_ a non-zero value at
its last position, for example `Size<3>{{0, 0, 8}}`. Specifically, in
that case the iterators returned by `IndexRange::begin()` and
`IndexRange::end()` were different, while they should compare equal.
This bug caused Valgrind defects, issue InsightSoftwareConsortium#1397, reported by Bradley
@blowekamp

The bug affects both `IndexRange` specializations,
`ImageRegionIndexRange` and `ZeroBasedIndexRange`.

This bug fix ensures that a `itk::Size` that has one or more zero values
is treated the same way as a `itk::Size` that has _only_ zero values.

Fixes issue InsightSoftwareConsortium#1397 Valgrind Defects related to the MedianImageFilter
dzenanz added a commit that referenced this issue Nov 8, 2019
`IndexRange` did behave incorrectly when it would be constructed with an
`itk::Size` that has one or more zero values _and_ a non-zero value at
its last position, for example `Size<3>{{0, 0, 8}}`. Specifically, in
that case the iterators returned by `IndexRange::begin()` and
`IndexRange::end()` were different, while they should compare equal.
This bug caused Valgrind defects, issue #1397, reported by Bradley
@blowekamp

The bug affects both `IndexRange` specializations,
`ImageRegionIndexRange` and `ZeroBasedIndexRange`.

This bug fix ensures that a `itk::Size` that has one or more zero values
is treated the same way as a `itk::Size` that has _only_ zero values.

Fixes issue #1397 Valgrind Defects related to the MedianImageFilter
@N-Dekker

This comment has been minimized.

Copy link
Contributor

@N-Dekker N-Dekker commented Nov 9, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.