Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update toml11 #10330

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ in {
./doc
./misc
./precompiled-headers.h
./subprojects/toml11
./src
./COPYING
./scripts/local.mk
Expand All @@ -182,6 +183,7 @@ in {
# Source might not be compiled, but still must be available
# for Doxygen to gather comments.
./src
./subprojects/toml11
./tests/unit
] ++ lib.optionals buildUnitTests [
./tests/unit
Expand Down
2 changes: 1 addition & 1 deletion src/libexpr/primops/fromTOML.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "primops.hh"
#include "eval-inline.hh"

#include "../../toml11/toml.hpp"
#include "../../../subprojects/toml11/toml.hpp"

#include <sstream>

Expand Down
88 changes: 88 additions & 0 deletions subprojects/toml11/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
version: 2.1

jobs:
test_suite:
docker:
- image: cimg/go:1.16
steps:
- checkout
- run:
command: |
g++ --version
cd tests/
g++ -std=c++11 -O2 -Wall -Wextra -Werror -I../ check_toml_test.cpp -o check_toml_test
export PATH=$(pwd):${PATH}
git clone --depth 1 --branch v1.3.0 https://github.com/BurntSushi/toml-test.git
cd toml-test/
go install -v ./cmd/toml-test
cd -
toml-test check_toml_test
# go clean -modcache
# go get github.com/BurntSushi/toml-test/cmd/toml-test
# $GOPATH/bin/toml-test ./check_toml_test
test_serialization:
docker:
- image: circleci/buildpack-deps:bionic
steps:
- checkout
- run:
command: |
g++ --version
cd tests/
g++ -std=c++11 -O2 -Wall -Wextra -Wpedantic -Werror -I../ check_serialization.cpp -o check_serialization
git clone https://github.com/BurntSushi/toml-test.git
cp check_serialization toml-test/tests/valid
cd toml-test/tests/valid
for f in $(ls ./*.toml);
do echo "==> ${f}";
cat ${f};
echo "---------------------------------------";
./check_serialization ${f};
if [ $? -ne 0 ] ; then
exit 1
fi
echo "=======================================";
done
output_result:
docker:
- image: circleci/buildpack-deps:bionic
steps:
- checkout
- run:
command: |
g++ --version
cd tests/
g++ -std=c++11 -O2 -Wall -Wextra -Wpedantic -Werror -I../ check.cpp -o check
git clone https://github.com/BurntSushi/toml-test.git
cp check toml-test/tests/invalid
cp check toml-test/tests/valid
cd toml-test/tests/invalid
for f in $(ls ./*.toml);
do echo "==> ${f}";
cat ${f};
echo "---------------------------------------";
./check ${f} invalid;
if [ $? -ne 0 ] ; then
exit 1
fi
echo "=======================================";
done
cd ../valid
for f in $(ls ./*.toml);
do echo "==> ${f}";
cat ${f};
echo "---------------------------------------";
./check ${f} valid;
if [ $? -ne 0 ] ; then
exit 1
fi
echo "=======================================";
done

workflows:
version: 2.1
test:
jobs:
- test_suite
- test_serialization
- output_result
6 changes: 6 additions & 0 deletions subprojects/toml11/.clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool

COPY . $SRC/toml11
COPY .clusterfuzzlite/build.sh $SRC/build.sh
WORKDIR $SRC/toml11
3 changes: 3 additions & 0 deletions subprojects/toml11/.clusterfuzzlite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ClusterFuzzLite set up

This folder contains a fuzzing set for [ClusterFuzzLite](https://google.github.io/clusterfuzzlite).
6 changes: 6 additions & 0 deletions subprojects/toml11/.clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -eu
# Copy fuzzer executable to $OUT/
$CXX $CFLAGS $LIB_FUZZING_ENGINE \
$SRC/toml11/.clusterfuzzlite/parse_fuzzer.cpp \
-o $OUT/parse_fuzzer \
-I$SRC/toml11/
16 changes: 16 additions & 0 deletions subprojects/toml11/.clusterfuzzlite/parse_fuzzer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#include <toml.hpp>

#include <sstream>
#include <string>

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
std::string s(reinterpret_cast<const char *>(data), size);
std::istringstream iss(s);
try {
const auto ref = toml::parse(iss);
} catch (...) {
}

return 0;
}
1 change: 1 addition & 0 deletions subprojects/toml11/.clusterfuzzlite/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: c++
13 changes: 13 additions & 0 deletions subprojects/toml11/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
indent_style = space

[CMakeLists.txt]
indent_size = 4

[*.{c,h}*]
indent_size = 4

[*.{md,yml}]
indent_size = 2
30 changes: 30 additions & 0 deletions subprojects/toml11/.github/workflows/cflite_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ClusterFuzzLite PR fuzzing
on:
workflow_dispatch:
pull_request:
branches: [ master ]
permissions: read-all
jobs:
PR:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address]
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
sanitizer: ${{ matrix.sanitizer }}
language: c++
bad-build-check: false
- name: Run Fuzzers (${{ matrix.sanitizer }})
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 240
mode: 'code-change'
report-unreproducible-crashes: false
sanitizer: ${{ matrix.sanitizer }}
Loading
Loading