[pupnp] shift files (#8705)

files are in the main repo https://github.com/pupnp/pupnp/pull/417

Signed-off-by: 0x34d <ajsinghyadav00@gmail.com>

Signed-off-by: 0x34d <ajsinghyadav00@gmail.com>
This commit is contained in:
Arjun 2022-10-07 14:46:06 +05:30 committed by GitHub
parent e6987e16ab
commit 709d057f3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 77 deletions

View File

@ -14,9 +14,8 @@
#
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y autoconf libtool-bin pkg-config
RUN apt-get update && apt-get install -y cmake
RUN git clone https://github.com/pupnp/pupnp
RUN git clone https://github.com/0x34d/oss-fuzz-bloat
COPY build.sh $SRC/
COPY FuzzIxml.c $SRC/pupnp/FuzzIxml.c
WORKDIR $SRC/pupnp/

View File

@ -1,67 +0,0 @@
/* Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "ixml.h"
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define kMinInputLength 10
#define kMaxInputLength 5120
int CheckXML(char *filename){
int rc;
DOMString s;
IXML_Document *doc = NULL;
rc = ixmlLoadDocumentEx(filename, &doc);
if (rc != IXML_SUCCESS) {
return rc;
}
s = ixmlPrintDocument(doc);
if (s == NULL || s[0] == '\0') {
ixmlDocument_free(doc);
return 1;
}
ixmlFreeDOMString(s);
ixmlDocument_free(doc);
return 0;
}
extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (Size < kMinInputLength || Size > kMaxInputLength){
return 1;
}
int ret;
char filename[256];
sprintf(filename, "/tmp/libfuzzer.%d", getpid());
FILE *fp = fopen(filename, "wb");
if (!fp) {
return 0;
}
fwrite(Data, Size, 1, fp);
fclose(fp);
ret = CheckXML(filename);
unlink(filename);
return ret;
}

View File

@ -14,16 +14,15 @@
# limitations under the License.
#
################################################################################
./bootstrap
./configure CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" --enable-debug --disable-shared
export CXXFLAGS="$CFLAGS"
mkdir build
cd build
cmake -DFUZZER=ON -DLIB_FUZZING_ENGINE="$LIB_FUZZING_ENGINE" ../
make -j$(nproc)
$CC $CFLAGS -fPIE -pipe -Wall -Wextra -DHAVE_CONFIG_H -DDEBUG -DIXML_HAVE_SCRIPTSUPPORT \
-I./ixml/inc/ -I./upnp/inc -c FuzzIxml.c
$CXX $CFLAGS -fPIE -pipe -o FuzzIxml FuzzIxml.o $LIB_FUZZING_ENGINE ./ixml/.libs/libixml.a
cp FuzzIxml $OUT/FuzzIxml
cp fuzzer/FuzzIxml $OUT/FuzzIxml
pushd $SRC/oss-fuzz-bloat/pupnp/
cp FuzzIxml_seed_corpus.zip $OUT/FuzzIxml_seed_corpus.zip