1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

fuzz: Don't check for malloc failures when serializing

DTD serialization doesn't report malloc failures yet.
This commit is contained in:
Nick Wellnhofer 2024-02-01 17:02:24 +01:00
parent 6aae176798
commit 84e50a0c48

View File

@ -70,12 +70,25 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
buffer = xmlBufferCreate();
save = xmlSaveToBuffer(buffer, NULL, 0);
if (save != NULL) {
#if 0
int errNo;
/*
* DTD serialization doesn't report malloc failures:
*
* - xmlBufDumpNotationTable
* - xmlBufDumpElementDecl
* - xmlBufDumpAttributeDecl
* - xmlBufDumpEntityDecl
*/
xmlSaveDoc(save, doc);
errNo = xmlSaveFinish(save);
xmlFuzzCheckMallocFailure("xmlDocDumpMemory",
xmlFuzzCheckMallocFailure("xmlSaveDoc",
errNo == XML_ERR_NO_MEMORY);
#else
xmlSaveDoc(save, doc);
xmlSaveFinish(save);
#endif
}
xmlBufferFree(buffer);
#endif