2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Guard against 0 byte writes in Pl_Buffer and Pl_String

This commit is contained in:
m-holger 2024-08-07 16:19:16 +01:00
parent 6aa6c01303
commit 0663f1f8db
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);