Please remove bit field specifier of `image::format_enum`
I have confirmed that this format
member is treated as signed integer on Visual Studio 2022.
image::format_enum format : 3;
Setting format_bgr24 (5)
to format
becomes -3
const image img(reinterpret_cast<char *>(data_ptr), bw, bh, d->image_format);
*
0 1 2 3 4 5 6 7
-4 -3 -2 -1
As a result, calling of image_private::create_data
fails on detaching image::detach()
, because old_d->format
is -3
.
d = image_private::create_data(old_d->width, old_d->height, old_d->format);
image
points to released bitmap and it leads to access violation (SIGSEGV on Linux).