Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
pdf: reads that gcc -O2 sees as set (Linux production build)
Martin Vogele1dfdab5cb5f
diff --git a/internal/cbm/pdf/pdf_font.c b/internal/cbm/pdf/pdf_font.cindex b1d531e29..d93896155 100644--- a/internal/cbm/pdf/pdf_font.c+++ b/internal/cbm/pdf/pdf_font.c@@ -1036,10 +1036,14 @@ static bool ttf_fmt4(const unsigned char *p, size_t len, size_t so, uint32_t *reuint32_t start;uint32_t delta;uint32_t ro;- rd16(p, len, ends + 2 * (size_t)s, &end);- rd16(p, len, starts + 2 * (size_t)s, &start);- rd16(p, len, deltas + 2 * (size_t)s, &delta);- rd16(p, len, ro_pos + 2 * (size_t)s, &ro);+ /* in range by the check above; a failed read fails the map like the+ * prototype's short slice (and gcc -O2 sees every value set) */+ if (!rd16(p, len, ends + 2 * (size_t)s, &end) ||+ !rd16(p, len, starts + 2 * (size_t)s, &start) ||+ !rd16(p, len, deltas + 2 * (size_t)s, &delta) ||+ !rd16(p, len, ro_pos + 2 * (size_t)s, &ro)) {+ return false;+ }uint32_t last = end < 0xFFFEU ? end : 0xFFFEU;if (start > last) {continue;@@ -1100,9 +1104,10 @@ static bool ttf_fmt12(const unsigned char *p, size_t len, size_t so, uint32_t *ruint32_t b;uint32_t g0;size_t at = so + 16 + 12 * (size_t)i;- rd32(p, len, at, &a);- rd32(p, len, at + 4, &b);- rd32(p, len, at + 8, &g0);+ /* in range by the check above (gcc -O2 sees every value set) */+ if (!rd32(p, len, at, &a) || !rd32(p, len, at + 4, &b) || !rd32(p, len, at + 8, &g0)) {+ return false;+ }uint64_t cmax = (uint64_t)a + PDF_GID_SPACE;if ((uint64_t)b < cmax) {cmax = b;diff --git a/internal/cbm/pdf/pdf_obj.c b/internal/cbm/pdf/pdf_obj.cindex 25fcafaa8..d3c728db6 100644--- a/internal/cbm/pdf/pdf_obj.c+++ b/internal/cbm/pdf/pdf_obj.c@@ -1774,12 +1774,10 @@ static bool xref_stream_at(pdf_doc_t *d, int64_t off, pdf_xref_t *sec, pdf_val_tbool dflt = !index || (index->kind == PV_ARR && index->count == 0) ||(index->kind == PV_NUM && index->num == 0.0) ||(index->kind == PV_BOOL && !index->b);- int64_t pairs[2];+ int64_t pairs[2] = {0, 0}; /* read only on the default /Index (no items) */pdf_val_t **items = NULL;int nitems = 0;if (dflt) {- pairs[0] = 0;- pairs[1] = 0;if (size && !num_to_int(size, &pairs[1])) {return false;}