ff4ff35918
Red Bear OS is a full fork. All sources must be available from git clone with zero network access. Removed gitignore rules that excluded fetched source trees under recipes/*/source/, local/recipes/kde/*/source/, local/recipes/qt/*/source/, and vendor source trees. Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded. 127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt frameworks, mesa, wayland, DRM drivers, and every other recipe source.
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
/*
|
|
* regexp.c: a libFuzzer target to test the regexp module.
|
|
*
|
|
* See Copyright for the status of this software.
|
|
*/
|
|
|
|
#include <libxml/xmlregexp.h>
|
|
#include "fuzz.h"
|
|
|
|
int
|
|
LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
|
|
char ***argv ATTRIBUTE_UNUSED) {
|
|
xmlFuzzMemSetup();
|
|
xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
|
xmlRegexpPtr regexp;
|
|
size_t maxAlloc;
|
|
const char *str1;
|
|
|
|
if (size > 200)
|
|
return(0);
|
|
|
|
xmlFuzzDataInit(data, size);
|
|
maxAlloc = xmlFuzzReadInt(4) % (size * 8 + 1);
|
|
str1 = xmlFuzzReadString(NULL);
|
|
|
|
/* CUR_SCHAR doesn't handle invalid UTF-8 and may cause infinite loops. */
|
|
if (xmlCheckUTF8(BAD_CAST str1) != 0) {
|
|
xmlFuzzMemSetLimit(maxAlloc);
|
|
regexp = xmlRegexpCompile(BAD_CAST str1);
|
|
/* xmlRegexpExec has pathological performance in too many cases. */
|
|
#if 0
|
|
xmlRegexpExec(regexp, BAD_CAST str2);
|
|
#endif
|
|
xmlRegFreeRegexp(regexp);
|
|
}
|
|
|
|
xmlFuzzMemSetLimit(0);
|
|
xmlFuzzDataCleanup();
|
|
xmlResetLastError();
|
|
|
|
return 0;
|
|
}
|
|
|