Skip to content

Commit

Permalink
PR #13005 from acasalboni: align to width and height -1 to prevent SS…
Browse files Browse the repository at this point in the history
…EGV accessing out of range buffer
  • Loading branch information
Nir-Az authored Jun 23, 2024
2 parents 52129b4 + e9f2a37 commit 7e5f223
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4170,9 +4170,9 @@ bool is_pixel_in_line(const float curr[2], const float start[2], const float end
void adjust_2D_point_to_boundary(float p[2], int width, int height)
{
if (p[0] < 0) p[0] = 0;
if (p[0] > width) p[0] = (float)width;
if (p[0] >= width) p[0] = (float)width - 1;
if (p[1] < 0) p[1] = 0;
if (p[1] > height) p[1] = (float)height;
if (p[1] >= height) p[1] = (float)height - 1;
}


Expand Down

0 comments on commit 7e5f223

Please sign in to comment.