summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-11-10 18:10:02 +0100
committerGitHub <noreply@github.com>2020-11-10 18:10:02 +0100
commita80ec80b57f419d84d196fb46dcb5f194c880001 (patch)
treeb92e1c797f7b7b985dad74e82e1f7715c8a3e87f
parent9397a5a272ba0b45bfb5e88b8884e992524786a5 (diff)
parentec6a4c92fe4817dd45bf0f7a5d6ad8853a16c6e3 (diff)
Merge pull request #43441 from pWNn1sher/master
Checking for half_image_size[ x & y ] to be non-negative.
-rw-r--r--thirdparty/jpeg-compressor/jpgd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/thirdparty/jpeg-compressor/jpgd.cpp b/thirdparty/jpeg-compressor/jpgd.cpp
index baf6ea0484..d6b5d96aac 100644
--- a/thirdparty/jpeg-compressor/jpgd.cpp
+++ b/thirdparty/jpeg-compressor/jpgd.cpp
@@ -1669,7 +1669,7 @@ namespace jpgd {
int row = m_max_mcu_y_size - m_mcu_lines_left;
uint8* d0 = m_pScan_line_0;
- const int half_image_x_size = (m_image_x_size >> 1) - 1;
+ const int half_image_x_size = (m_image_x_size == 1) ? 0 : (m_image_x_size >> 1) - 1;
const int row_x8 = row * 8;
for (int x = 0; x < m_image_x_size; x++)
@@ -1762,7 +1762,7 @@ namespace jpgd {
int y = m_image_y_size - m_total_lines_left;
int row = y & 15;
- const int half_image_y_size = (m_image_y_size >> 1) - 1;
+ const int half_image_y_size = (m_image_y_size == 1) ? 0 : (m_image_y_size >> 1) - 1;
uint8* d0 = m_pScan_line_0;
@@ -1891,7 +1891,7 @@ namespace jpgd {
int y = m_image_y_size - m_total_lines_left;
int row = y & 15;
- const int half_image_y_size = (m_image_y_size >> 1) - 1;
+ const int half_image_y_size = (m_image_y_size == 1) ? 0 : (m_image_y_size >> 1) - 1;
uint8* d0 = m_pScan_line_0;
@@ -1915,7 +1915,7 @@ namespace jpgd {
const int y0_base = (c_y0 & 7) * 8 + 256;
const int y1_base = (c_y1 & 7) * 8 + 256;
- const int half_image_x_size = (m_image_x_size >> 1) - 1;
+ const int half_image_x_size = (m_image_x_size == 1) ? 0 : (m_image_x_size >> 1) - 1;
static const uint8_t s_muls[2][2][4] =
{