A stream's /Length through its references (at most PDF_MAX_RESOLVE, as * pdf_resolve). */
| 1169 | /* A stream's /Length through its references (at most PDF_MAX_RESOLVE, as |
| 1170 | * pdf_resolve). */ |
| 1171 | static pdf_val_t *length_value(pdf_doc_t *d, pdf_val_t *v) { |
| 1172 | for (int depth = 0; v && v->kind == PV_REF; depth++) { |
| 1173 | pdf_xent_t *e = xent(d, v->ref_num); |
| 1174 | if (depth >= PDF_MAX_RESOLVE || !e || e->loading || e->not_length) { |
| 1175 | return NULL; |
| 1176 | } |
| 1177 | if (e->cached) { |
| 1178 | v = e->obj; |
| 1179 | } else if (e->type == 1) { |
| 1180 | v = length_object(d, v->ref_num); |
| 1181 | } else { |
| 1182 | v = pdf_get(d, v->ref_num); |
| 1183 | } |
| 1184 | } |
| 1185 | return v; |
| 1186 | } |
| 1187 | |
| 1188 | /* The object at off (or off + hdr), a stream with its raw bytes when one |
| 1189 | * follows. NULL: no matching header there. */ |
no test coverage detected