mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
block_edges: Add assertions for block coordinates
Check whether the top right point of the block is inside of the thresholded image t_pix. Otherwise the following code would make illegal memory accesses. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
cd58a861d9
commit
5812972775
@ -50,6 +50,8 @@ void block_edges(Pix *t_pix, // thresholded image
|
||||
CRACKEDGE *free_cracks = nullptr;
|
||||
|
||||
block->bounding_box(bleft, tright); // block box
|
||||
ASSERT_HOST(tright.x() <= width);
|
||||
ASSERT_HOST(tright.y() <= height);
|
||||
int block_width = tright.x() - bleft.x();
|
||||
for (int x = block_width; x >= 0; x--)
|
||||
ptrline[x] = nullptr; // no lines in progress
|
||||
|
Loading…
Reference in New Issue
Block a user