IterLength
Description
Total length (in elements) of the region the iterator covers.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
MachO.c:174:
static bool decode_segment_64(MachoContext *ctx, BufIter *cmd) {
u64 cmdsize = IterLength(cmd);
if (cmdsize < SEG64_CMD_SIZE_MIN) {
LOG_ERROR("MachO: LC_SEGMENT_64 truncated");- In
MachO.c:213:
// SECT64_SIZE bytes.
for (u32 i = 0; i < seg.nsects; ++i) {
if (IterIndex(cmd) + SECT64_SIZE > IterLength(cmd)) {
LOG_ERROR("MachO: section table overruns LC_SEGMENT_64");
return false;- In
MachO.c:263:
static bool decode_symtab(MachoContext *ctx, BufIter *cmd) {
if (IterLength(cmd) < SYMTAB_CMD_SIZE) {
LOG_ERROR("MachO: LC_SYMTAB truncated");
return false;- In
MachO.c:279:
static bool decode_uuid(MachoContext *ctx, BufIter *cmd) {
if (IterLength(cmd) < UUID_CMD_SIZE) {
LOG_ERROR("MachO: LC_UUID truncated");
return false;- In
Dwarf.c:171:
// start of the line number program body.
static bool skip_line_program_tables(BufIter *cur) {
while (IterIndex(cur) < IterLength(cur) && *IterDataAt(cur, IterIndex(cur)) != 0) {
if (!BufReadZstr(cur))
return false;- In
Dwarf.c:177:
// Must-precondition: the surrounding `IterIndex < IterLength` test
// proves there is at least one more byte to consume (the NUL).
if (IterIndex(cur) < IterLength(cur))
IterMustNext(cur); // empty terminator
- In
Dwarf.c:180:
IterMustNext(cur); // empty terminator
while (IterIndex(cur) < IterLength(cur) && *IterDataAt(cur, IterIndex(cur)) != 0) {
if (!BufReadZstr(cur))
return false;- In
Dwarf.c:193:
// Must-precondition: same `IterIndex < IterLength` proof as the
// include_directories terminator above.
if (IterIndex(cur) < IterLength(cur))
IterMustNext(cur); // empty terminator
return true;- In
Dwarf.c:229:
static bool collect_cu_strings(BufIter cur, Str *pool, CuStrings *cs) {
// include_directories
while (IterIndex(&cur) < IterLength(&cur) && *IterDataAt(&cur, IterIndex(&cur)) != 0) {
Zstr dir = BufReadZstr(&cur);
if (!dir)- In
Dwarf.c:241:
// Must-precondition: `IterIndex < IterLength` proves there is a
// terminator byte left to consume.
if (IterIndex(&cur) < IterLength(&cur))
IterMustNext(&cur); // empty terminator
- In
Dwarf.c:245:
// file_names
while (IterIndex(&cur) < IterLength(&cur) && *IterDataAt(&cur, IterIndex(&cur)) != 0) {
Zstr name = BufReadZstr(&cur);
if (!name)- In
DwarfInfo.c:555:
}
size unit_end_pos = unit_start_pos + 4u + unit_length;
if (unit_end_pos > IterLength(&info_cur) || unit_end_pos < unit_start_pos) {
LOG_ERROR("DWARF info: CU overruns section");
ok = false;- In
Dns.c:110:
u64 name_len = 0;
u64 label_idx = 0;
while (cur < IterLength(it)) {
u8 b = *IterDataAt(it, cur);
if (b == 0) {- In
Dns.c:126:
if ((b & 0xC0u) == 0xC0u) {
// Compression pointer: 14-bit offset.
if (cur + 2 > IterLength(it)) {
return false;
}- In
Dns.c:152:
}
u64 label_len = (u64)b;
if (cur + 1 + label_len > IterLength(it)) {
return false;
}- In
Dns.c:195:
rec->ttl = ttl;
if (IterIndex(it) + (u64)rdlength > IterLength(it)) {
return false;
}- In
Pe.c:483:
// Verify the trailing path is NUL-terminated inside the record.
const u8 *path_start = IterDataAt(&cv_cur, IterIndex(&cv_cur));
const u8 *region_end = IterDataAt(&cv_cur, IterLength(&cv_cur));
bool terminated = false;
for (const u8 *p = path_start; p < region_end; ++p) {- In
StrIter.h:185:
/// TAGS: StrIter, Length, Alias
///
#define StrIterLength(mi) IterLength(mi)
///
- In
Access.h:78:
/// TAGS: Memory, Size, Iter
///
#define IterSize(mi) (IterLength(mi) * ALIGN_UP(sizeof(ITER_DATA_TYPE(mi)), (mi)->alignment))
///
Last updated on