Commit 958776be for tesseract

commit 958776bef946e65eeb41dfb8306dd29201932e9b
Author: Stefan Weil <sw@weilnetz.de>
Date:   Fri Nov 13 17:30:59 2026 +0100

    wordstrbox: fix missing end of the last line of a page

    GetWordStrBoxText() only wrote the end-of-line record and the newline
    for the last text line if left, top, right and bottom of that line
    were all non-zero. But 0 is a valid coordinate, so a last line which
    touches the left or the top edge of the image was not terminated, and
    the first record of the next page was appended to it.

    Use the existing flag first_line, like GetLSTMBoxText() uses
    first_word.

    Fix proposed by the Anthropic OSS Scanner (finding ANT-2026-62L14G1E).

    Assisted-by: OpenCode / Claude Fable 5.2 (Anthropic)
    Signed-off-by: Stefan Weil <sw@weilnetz.de>

diff --git a/src/api/wordstrboxrenderer.cpp b/src/api/wordstrboxrenderer.cpp
index c9baf00a..e6dd769e 100644
--- a/src/api/wordstrboxrenderer.cpp
+++ b/src/api/wordstrboxrenderer.cpp
@@ -74,7 +74,7 @@ char *TessBaseAPI::GetWordStrBoxText(int page_number = 0) {
     } while (!res_it->Empty(RIL_BLOCK) && !res_it->IsAtBeginningOf(RIL_WORD));
   }

-  if (left != 0 && top != 0 && right != 0 && bottom != 0) {
+  if (!first_line) { // if first_line is true => empty page
     wordstr_box_str += "\n\t " + std::to_string(right + 1);
     wordstr_box_str += " " + std::to_string(image_height_ - bottom);
     wordstr_box_str += " " + std::to_string(right + 5);