From 0ac70e68839191128fb6a26b9dc7d0dfacb45a5e Mon Sep 17 00:00:00 2001 From: Alexander Shishkov Date: Thu, 29 Mar 2012 13:46:54 +0000 Subject: [PATCH] fixed #1421 --- modules/highgui/src/grfmt_bmp.cpp | 2 ++ modules/highgui/test/test_grfmt.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/modules/highgui/src/grfmt_bmp.cpp b/modules/highgui/src/grfmt_bmp.cpp index 313bea22f6..6d1c00863b 100644 --- a/modules/highgui/src/grfmt_bmp.cpp +++ b/modules/highgui/src/grfmt_bmp.cpp @@ -411,6 +411,8 @@ decode_rle4_bad: ; } line_end_flag = 0; + if( y >= m_height ) + break; } } diff --git a/modules/highgui/test/test_grfmt.cpp b/modules/highgui/test/test_grfmt.cpp index df2d87e291..377d8b2c92 100644 --- a/modules/highgui/test/test_grfmt.cpp +++ b/modules/highgui/test/test_grfmt.cpp @@ -181,5 +181,27 @@ public: } }; +class CV_GrfmtReadBMPRLE8Test : public cvtest::BaseTest +{ +public: + void run(int) + { + try + { + Mat rle = imread(string(ts->get_data_path()) + "readwrite/rle8.bmp"); + Mat bmp = imread(string(ts->get_data_path()) + "readwrite/ordinary.bmp"); + if (norm(rle-bmp)>1.e-10) + ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY); + } + catch(...) + { + ts->set_failed_test_info(cvtest::TS::FAIL_EXCEPTION); + } + ts->set_failed_test_info(cvtest::TS::OK); + } +}; + TEST(Highgui_Grfmt_WriteBigImage, regression) { CV_GrfmtWriteBigImageTest test; test.safe_run(); } TEST(Highgui_Grfmt_WriteSequenceImage, regression) { CV_GrfmtWriteSequenceImageTest test; test.safe_run(); } +TEST(GrfmtReadBMPRLE8, regression) { CV_GrfmtReadBMPRLE8Test test; test.safe_run(); } +