Commit 46727840 for tesseract

commit 467278405f79bb2b0b3eddf9c9e3dbe4bf605862
Author: Stefan Weil <sw@weilnetz.de>
Date:   Fri Nov 13 17:30:07 2026 +0100

    textord: do not chop an outline which is not left of the chop line

    fixed_chop_coutline() walks the outline from its leftmost point, and
    the walk only ends if that point is strictly left of the chop line.
    The existing test left_edge >= chop_coord - pitch_error only
    guarantees that for a pitch error which is not negative. The pitch
    error is derived from the parameter textord_fp_chop_error, so a
    negative value made the loop run forever.

    Also test left_edge >= chop_coord. Nothing changes for parameter
    values >= 0.

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

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

diff --git a/src/textord/fpchop.cpp b/src/textord/fpchop.cpp
index e6e6782e..5611d2ab 100644
--- a/src/textord/fpchop.cpp
+++ b/src/textord/fpchop.cpp
@@ -437,7 +437,11 @@ static bool fixed_chop_coutline(     // chop the outline
     }
     pos += srcline->step(stepindex);
   }
-  if (left_edge >= chop_coord - pitch_error) {
+  // The walk below starts at the leftmost point and only terminates if that
+  // point is strictly left of the chop line, so refuse to chop an outline
+  // whose left edge is on it regardless of pitch_error (which comes from a
+  // parameter and may be negative).
+  if (left_edge >= chop_coord || left_edge >= chop_coord - pitch_error) {
     return false; // not worth it
   }