ReaderImplBase: Fix strings subsection validity check
A strings section with 0 strings is still 1 byte long. Also improve the error output in the error case.
This commit is contained in:
@@ -617,11 +617,11 @@ ReaderImplBase::InitSection(PackageFileSection& section, uint64 endOffset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check strings subsection size/count
|
// check strings subsection size/count
|
||||||
if ((stringsLength == 0) != (stringsCount == 0) || stringsLength > length) {
|
if ((stringsLength <= 1) != (stringsCount == 0) || stringsLength > length) {
|
||||||
ErrorOutput()->PrintError("Error: strings subsection description of %s "
|
ErrorOutput()->PrintError("Error: strings subsection description of %s "
|
||||||
"file %s section is invalid (%" B_PRIu64 " strings, length: %"
|
"file %s section is invalid (%" B_PRIu64 " strings, length: %"
|
||||||
B_PRIu64 ")\n",
|
B_PRIu64 ", section length: %" B_PRIu64 ")\n",
|
||||||
fFileType, section.name, length, stringsCount, stringsLength);
|
fFileType, section.name, stringsCount, stringsLength, length);
|
||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user