Headline
CVE-2022-1534: Fix array boundary check when parsing inflections which could result … · bfabiszewski/libmobi@fb1ab50
Buffer Over-read at parse_rawml.c:1416 in GitHub repository bfabiszewski/libmobi prior to 0.11. The bug causes the program reads data past the end of the intented buffer. Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash.
@@ -1413,6 +1413,10 @@ MOBI_RET mobi_reconstruct_infl(char *outstring, const MOBIIndx *infl, const MOBI
unsigned char decoded[INDX_INFLBUF_SIZEMAX + 1];
memset(decoded, 0, INDX_INFLBUF_SIZEMAX + 1);
if (parts[j] >= infl->entries_count) {
debug_print("%s\n", “Invalid entry offset”);
return MOBI_DATA_CORRUPT;
}
unsigned char *rule = (unsigned char *) infl->entries[parts[j]].label;
memcpy(decoded, label, label_length);
int decoded_length = (int) label_length;