hmmlib2 2.0.12: Clamp ref->offset to text_len

This commit is contained in:
Matt Mascarenhas 2021-05-31 18:06:32 +01:00
parent c104500020
commit a6a9653306
1 changed files with 8 additions and 1 deletions

View File

@ -696,6 +696,13 @@ static void _hmml_parse_timestamps(struct _hmml_parser* p)
} }
} }
for(size_t i = 0; i < ts.reference_count; ++i) {
HMML_Reference* ref = ts.references + i;
if(ref->offset > text_len) {
ref->offset = text_len;
}
}
_hmml_persist_array(p, &p->out.timestamps, &p->out.timestamp_count, ts); _hmml_persist_array(p, &p->out.timestamps, &p->out.timestamp_count, ts);
} }
} }
@ -813,7 +820,7 @@ void hmml_free(HMML_Output* out)
} }
const struct HMML_Version hmml_version = { const struct HMML_Version hmml_version = {
2, 0, 11 2, 0, 12
}; };
#undef HSTX #undef HSTX