[subset] Detect CFF charstring budget exhaustion at zero, not below

The shared CFF charstring budget is only ever spent through the
cs_interpreter_t interpret() cap, which clamps each glyph's operator
count to the remaining budget and charges back exactly what it
consumed.  By construction it never overshoots, so an exhausted
budget lands at exactly 0 rather than going negative.

The exhaustion checks therefore compare budget <= 0 (cff1 depend()'s
seac walk) and budget > 0 (the subset planner's seac-closure and CFF2
get_extents verdicts), not < 0 / >= 0, which that path can never
reach.  With < 0, cff1 depend() never failed, so
hb_subset_depend_from_face_or_fail() returned a result for an
adversarial font that exhausts the budget even though the equivalent
subset fails; that is the test-subset-cff1 shared-subrs case on CI
builds with -Dexperimental_api=true.  Document this at each check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh
index e7c2f26..50724ab 100644
--- a/src/hb-ot-cff1-table.hh
+++ b/src/hb-ot-cff1-table.hh
@@ -1625,6 +1625,9 @@
         builder->add_depend (gid, HB_TAG('C','F','F',' '), accent_gid);
       }
     }
+    /* The charstring interpreter caps each glyph at the remaining budget and
+     * never overshoots, so exhaustion leaves the budget at exactly 0 rather
+     * than negative; treat that as failure too. */
     if (unlikely (budget <= 0))
       builder->fail ();
   }
diff --git a/src/hb-subset-plan-var.cc b/src/hb-subset-plan-var.cc
index d59c180..25a8009 100644
--- a/src/hb-subset-plan-var.cc
+++ b/src/hb-subset-plan-var.cc
@@ -799,6 +799,7 @@
         plan->bounds_height_vec[new_gid] = hb_saturate_neg (extents.height);
     }
   }
+  /* Exhaustion saturates the interpreter budget at exactly 0, not below. */
   plan->check_success (*budget > 0);
   /* No glyph contributed bounds: do not serialize the accumulator's
    * inverted sentinels into head (or a downgraded CFF FontBBox). */
diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index 224ea2f..a5cbb80 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -537,6 +537,7 @@
       for (hb_codepoint_t gid : cur_glyphset)
 	if (_add_cff_seac_components (*cff, gid, &plan->_glyphset, budget))
 	  has_seac = true;
+      /* Exhaustion saturates the interpreter budget at exactly 0, not below. */
       plan->check_success (*budget > 0);
     }
     plan->has_seac = has_seac;