Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7207310

Browse files
committed
Fix two cases of signed integer overflow.
This tweaks two cases where there is potential for signed integer overflow: * in `rewind_scanlines`, we switch to unsigned ints * in `not_equal`, we switch for operations which cannot overflow. These cases were caught by matplotlib-using tests being run under [ASan](https://github.com/google/sanitizers) with a check for signed integer overflow.
1 parent 6a91a4e commit 7207310

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

extern/agg24-svn/include/agg_rasterizer_scanline_aa_nogamma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace agg
6060

6161
int not_equal(int ex, int ey, const cell_aa&) const
6262
{
63-
return (ex - x) | (ey - y);
63+
return ex != x || ey != y;
6464
}
6565
};
6666

extern/agg24-svn/include/agg_scanline_storage_aa.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,10 +720,10 @@ namespace agg
720720
m_ptr = m_data;
721721
if(m_ptr < m_end)
722722
{
723-
m_min_x = read_int32() + m_dx;
724-
m_min_y = read_int32() + m_dy;
725-
m_max_x = read_int32() + m_dx;
726-
m_max_y = read_int32() + m_dy;
723+
m_min_x = read_int32u() + m_dx;
724+
m_min_y = read_int32u() + m_dy;
725+
m_max_x = read_int32u() + m_dx;
726+
m_max_y = read_int32u() + m_dy;
727727
}
728728
return m_ptr < m_end;
729729
}

0 commit comments

Comments
 (0)