Commit 59f4a2e0 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #14777 from alalek:oss_fuzz_15154

parents 11b020b9 f6230ae0
...@@ -537,6 +537,7 @@ bool TiffDecoder::readData( Mat& img ) ...@@ -537,6 +537,7 @@ bool TiffDecoder::readData( Mat& img )
} }
else else
{ {
CV_CheckEQ(wanted_channels, 3, "TIFF-8bpp: BGR/BGRA images are supported only");
icvCvt_BGRA2BGR_8u_C4C3R(bstart + i*tile_width0*4, 0, icvCvt_BGRA2BGR_8u_C4C3R(bstart + i*tile_width0*4, 0,
img.ptr(img_y + tile_height - i - 1, x), 0, img.ptr(img_y + tile_height - i - 1, x), 0,
Size(tile_width, 1), 2); Size(tile_width, 1), 2);
...@@ -544,6 +545,7 @@ bool TiffDecoder::readData( Mat& img ) ...@@ -544,6 +545,7 @@ bool TiffDecoder::readData( Mat& img )
} }
else else
{ {
CV_CheckEQ(wanted_channels, 1, "");
icvCvt_BGRA2Gray_8u_C4C1R( bstart + i*tile_width0*4, 0, icvCvt_BGRA2Gray_8u_C4C1R( bstart + i*tile_width0*4, 0,
img.ptr(img_y + tile_height - i - 1, x), 0, img.ptr(img_y + tile_height - i - 1, x), 0,
Size(tile_width, 1), 2); Size(tile_width, 1), 2);
...@@ -569,12 +571,14 @@ bool TiffDecoder::readData( Mat& img ) ...@@ -569,12 +571,14 @@ bool TiffDecoder::readData( Mat& img )
{ {
if (ncn == 1) if (ncn == 1)
{ {
CV_CheckEQ(wanted_channels, 3, "");
icvCvt_Gray2BGR_16u_C1C3R(buffer16 + i*tile_width0*ncn, 0, icvCvt_Gray2BGR_16u_C1C3R(buffer16 + i*tile_width0*ncn, 0,
img.ptr<ushort>(img_y + i, x), 0, img.ptr<ushort>(img_y + i, x), 0,
Size(tile_width, 1)); Size(tile_width, 1));
} }
else if (ncn == 3) else if (ncn == 3)
{ {
CV_CheckEQ(wanted_channels, 3, "");
icvCvt_RGB2BGR_16u_C3R(buffer16 + i*tile_width0*ncn, 0, icvCvt_RGB2BGR_16u_C3R(buffer16 + i*tile_width0*ncn, 0,
img.ptr<ushort>(img_y + i, x), 0, img.ptr<ushort>(img_y + i, x), 0,
Size(tile_width, 1)); Size(tile_width, 1));
...@@ -589,6 +593,7 @@ bool TiffDecoder::readData( Mat& img ) ...@@ -589,6 +593,7 @@ bool TiffDecoder::readData( Mat& img )
} }
else else
{ {
CV_CheckEQ(wanted_channels, 3, "TIFF-16bpp: BGR/BGRA images are supported only");
icvCvt_BGRA2BGR_16u_C4C3R(buffer16 + i*tile_width0*ncn, 0, icvCvt_BGRA2BGR_16u_C4C3R(buffer16 + i*tile_width0*ncn, 0,
img.ptr<ushort>(img_y + i, x), 0, img.ptr<ushort>(img_y + i, x), 0,
Size(tile_width, 1), 2); Size(tile_width, 1), 2);
...@@ -596,13 +601,12 @@ bool TiffDecoder::readData( Mat& img ) ...@@ -596,13 +601,12 @@ bool TiffDecoder::readData( Mat& img )
} }
else else
{ {
icvCvt_BGRA2BGR_16u_C4C3R(buffer16 + i*tile_width0*ncn, 0, CV_Error(Error::StsError, "Not supported");
img.ptr<ushort>(img_y + i, x), 0,
Size(tile_width, 1), 2);
} }
} }
else else
{ {
CV_CheckEQ(wanted_channels, 1, "");
if( ncn == 1 ) if( ncn == 1 )
{ {
memcpy(img.ptr<ushort>(img_y + i, x), memcpy(img.ptr<ushort>(img_y + i, x),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment