2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-09-22 10:09:06 +00:00

Merge pull request #1263 from m-holger/fuzz

Guard against 0 byte writes in Pl_Buffer and Pl_String
This commit is contained in:
m-holger 2024-08-08 01:09:15 +01:00 committed by GitHub
commit 0e9b9dab33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,9 @@ Pl_Buffer::~Pl_Buffer() // NOLINT (modernize-use-equals-default)
void
Pl_Buffer::write(unsigned char const* buf, size_t len)
{
if (!len) {
return;
}
m->data.append(reinterpret_cast<char const*>(buf), len);
m->ready = false;

View File

@ -21,6 +21,9 @@ Pl_String::~Pl_String() // NOLINT (modernize-use-equals-default)
void
Pl_String::write(unsigned char const* buf, size_t len)
{
if (!len) {
return;
}
m->s.append(reinterpret_cast<char const*>(buf), len);
if (getNext(true)) {
getNext()->write(buf, len);