Coverage Report

Created: 2025-08-26 07:06

/src/xmlsec/tests/oss-fuzz/xmlsec_target.c
Line
Count
Source
1
#include <stdint.h>
2
#include <xmlsec/buffer.h>
3
#include <xmlsec/parser.h>
4
5
2.28M
void ignore (void* ctx, const char* msg, ...) {
6
      // Error handler to avoid spam of error messages from libxml parser.
7
2.28M
}
8
9
18.0k
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
10
18.0k
    xmlSetGenericErrorFunc(NULL, &ignore);
11
18.0k
    xmlSecBufferPtr buf = xmlSecBufferCreate(size);
12
18.0k
    xmlSecBufferSetData(buf, data, size);
13
18.0k
    xmlDocPtr doc = xmlSecParseMemory(xmlSecBufferGetData(buf),
14
18.0k
            xmlSecBufferGetSize(buf), 0);
15
16
18.0k
    if (doc != NULL) xmlFreeDoc(doc);
17
18.0k
    xmlSecBufferDestroy(buf);
18
18.0k
    return 0;
19
18.0k
}