File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ bool BmpDecoder::readHeader()
118
118
119
119
if ( m_bpp <= 8 )
120
120
{
121
- CV_Assert (clrused < 256 );
121
+ CV_Assert (clrused <= 256 );
122
122
memset (m_palette, 0 , sizeof (m_palette));
123
123
m_strm.getBytes (m_palette, (clrused == 0 ? 1 <<m_bpp : clrused)*4 );
124
124
iscolor = IsColorPalette ( m_palette, m_bpp );
@@ -174,6 +174,7 @@ bool BmpDecoder::readHeader()
174
174
}
175
175
catch (...)
176
176
{
177
+ throw ;
177
178
}
178
179
// in 32 bit case alpha channel is used - so require CV_8UC4 type
179
180
m_type = iscolor ? (m_bpp == 32 ? CV_8UC4 : CV_8UC3 ) : CV_8UC1;
@@ -483,11 +484,12 @@ decode_rle8_bad: ;
483
484
result = true ;
484
485
break ;
485
486
default :
486
- assert ( 0 );
487
+ CV_ErrorNoReturn (cv::Error::StsError, " Invalid/unsupported mode " );
487
488
}
488
489
}
489
490
catch (...)
490
491
{
492
+ throw ;
491
493
}
492
494
493
495
return result;
Original file line number Diff line number Diff line change @@ -120,3 +120,12 @@ const string exts[] = {
120
120
};
121
121
122
122
INSTANTIATE_TEST_CASE_P (imgcodecs, Imgcodecs_Image, testing::ValuesIn(exts));
123
+
124
+ TEST (Imgcodecs_Image, regression_9376)
125
+ {
126
+ String path = findDataFile (" readwrite/regression_9376.bmp" );
127
+ Mat m = imread (path);
128
+ ASSERT_FALSE (m.empty ());
129
+ EXPECT_EQ (32 , m.cols );
130
+ EXPECT_EQ (32 , m.rows );
131
+ }
You can’t perform that action at this time.
0 commit comments