File: xmlsec_target.c

package info (click to toggle)
xmlsec1 1.3.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,916 kB
  • sloc: ansic: 100,493; xml: 19,156; sh: 8,079; makefile: 1,186; javascript: 438; perl: 199
file content (18 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <xmlsec/buffer.h>
#include <xmlsec/parser.h>

void ignore (void* ctx, const char* msg, ...) {
      // Error handler to avoid spam of error messages from libxml parser.
}

int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
    xmlSetGenericErrorFunc(NULL, &ignore);
    xmlSecBufferPtr buf = xmlSecBufferCreate(size);
    xmlSecBufferSetData(buf, data, size);
    xmlDocPtr doc = xmlSecParseMemory(xmlSecBufferGetData(buf),
            xmlSecBufferGetSize(buf), 0);

    if (doc != NULL) xmlFreeDoc(doc);
    xmlSecBufferDestroy(buf);
    return 0;
}