Opened 9 years ago

Closed 4 years ago

#9020 closed Bugs (duplicate)

kth_channel_view fails when used with virtual views

Reported by: Shaun Marko <smarko@…> Owned by: Stefan Seefeld
Milestone: To Be Determined Component: gil USE GITHUB
Version: Boost 1.52.0 Severity: Problem
Keywords: kth_channel_view virtual_2d_locator Cc: mateusz@…

Description

Given an image_view with a virtual_2d_locator that returns a planar_pixel_reference, kth_channel_view produces a kth_channel_deref_fn with an incorrect result_type which may result an invalid pointer dereference.

For example, consider a virtual_2d_locator instantiated with a dereference functor that returns a 'planar_pixel_reference<bits8&, rgb_t>'

An image_view instantiated with such a locator will have a reference type of 'planar_pixel_reference<bits8&,rgb_t>'. Now suppose this image_view is passed to kth_channel_view(). This results in the instantiation of a kth_channel_deref_fn with a result_type of 'pixel<bits8&, gray_layout_t>&'; however, the deref functor will initialize this result_type with a pixel<bits8,gray_layout_t>&'.

detail::kth_channel_deref_fn needs to ensure the channel type of its result_type is not a reference type.

Attachments (2)

image_view_factory.hpp.patch (772 bytes ) - added by Shaun Marko <smarko@…> 9 years ago.
patch to kth_channel_deref_fn in image_view_factory.hpp
kth.cpp (1.9 KB ) - added by Shaun Marko <smarko@…> 9 years ago.
Example program illustrating the issue.

Download all attachments as: .zip

Change History (6)

by Shaun Marko <smarko@…>, 9 years ago

patch to kth_channel_deref_fn in image_view_factory.hpp

by Shaun Marko <smarko@…>, 9 years ago

Attachment: kth.cpp added

Example program illustrating the issue.

comment:1 by Shaun Marko <smarko@…>, 9 years ago

Please retract this bug report. The proposed fix makes the kth_channel_view read-only for virtual views with reference types of planar_pixel_reference.

comment:2 by Mateusz Loskot, 6 years ago

Cc: mateusz@… added

comment:3 by Stefan Seefeld, 5 years ago

Owner: changed from Hailin Jin to Stefan Seefeld

comment:4 by Mateusz Loskot, 4 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.