mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-11 15:40:58 +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:
commit
0e9b9dab33
@ -19,6 +19,9 @@ Pl_Buffer::~Pl_Buffer() // NOLINT (modernize-use-equals-default)
|
|||||||
void
|
void
|
||||||
Pl_Buffer::write(unsigned char const* buf, size_t len)
|
Pl_Buffer::write(unsigned char const* buf, size_t len)
|
||||||
{
|
{
|
||||||
|
if (!len) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
m->data.append(reinterpret_cast<char const*>(buf), len);
|
m->data.append(reinterpret_cast<char const*>(buf), len);
|
||||||
m->ready = false;
|
m->ready = false;
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@ Pl_String::~Pl_String() // NOLINT (modernize-use-equals-default)
|
|||||||
void
|
void
|
||||||
Pl_String::write(unsigned char const* buf, size_t len)
|
Pl_String::write(unsigned char const* buf, size_t len)
|
||||||
{
|
{
|
||||||
|
if (!len) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
m->s.append(reinterpret_cast<char const*>(buf), len);
|
m->s.append(reinterpret_cast<char const*>(buf), len);
|
||||||
if (getNext(true)) {
|
if (getNext(true)) {
|
||||||
getNext()->write(buf, len);
|
getNext()->write(buf, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user