(strings: List[str])
| 256 | "extensions": {}, |
| 257 | } |
| 258 | |
| 259 | |
| 260 | def _ordinal_pool(entries: List[dict]) -> dict: |
| 261 | """A pool whose indexes are positions in a list, not hardware slots. |
| 262 | |
| 263 | `geometry` is absent and the index space is separately reported unavailable, |
| 264 | so a `ldr xN, [x27, #disp]` cannot be resolved through these. |
| 265 | """ |
| 266 | return {"index_space": "ordinal", "geometry": None, "entries": entries} |
| 267 | |
| 268 | |
| 269 | def _empty_pool() -> dict: |
| 270 | return _ordinal_pool([]) |
| 271 | |
| 272 | |
| 273 | # -------------------------------------------------------------------------- |
| 274 | # shared extraction |
| 275 | # -------------------------------------------------------------------------- |
| 276 | |
| 277 | |
| 278 | def _extract_strings(data: bytes, min_len: int = 5, max_items: int = 20000) -> List[str]: |
| 279 | out: List[str] = [] |
| 280 | for m in re.finditer(rb"[ -~]{%d,}" % min_len, data): |
| 281 | s = m.group(0).decode("utf-8", errors="ignore") |
| 282 | if len(s) > 220: |
| 283 | continue |
| 284 | if not _usable_value(s): |
| 285 | continue |
| 286 | out.append(s) |
| 287 | if len(out) >= max_items: |
no test coverage detected