Skip to content

Commit

Permalink
Merge branch 'master' into feat/steiner
Browse files Browse the repository at this point in the history
  • Loading branch information
szhorvat authored Apr 3, 2024
2 parents 451c5cd + b29d3fd commit b884fa2
Show file tree
Hide file tree
Showing 32 changed files with 149 additions and 317 deletions.
5 changes: 0 additions & 5 deletions .clusterfuzzlite/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion .clusterfuzzlite/project.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "build-essential,clang,cmake,cmake-curses-gui,ninja-build,ccache,colordiff,astyle,bison,flex,libxml2-dev,libarpack2-dev,libglpk-dev,libgmp-dev,xmlto,texinfo,source-highlight,libxml2-utils,xsltproc,fop"
"packages": "build-essential,clang,cmake,cmake-curses-gui,ninja-build,ccache,colordiff,astyle,bison,flex,libxml2-dev,libarpack2-dev,libglpk-dev,libgmp-dev,xmlto,texinfo,source-highlight,libxml2-utils,xsltproc,fop,docbook2x"
}
},

Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/cflite_batch.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/cflite_cron.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/cflite_pr.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CIFuzz
on: [pull_request]
permissions: {}
jobs:
Fuzzing:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'igraph'
language: c++
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'igraph'
language: c++
fuzz-seconds: 720
output-sarif: true
- name: Upload Crash
uses: actions/upload-artifact@v3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
- name: Upload Sarif
if: always() && steps.build.outcome == 'success'
uses: github/codeql-action/upload-sarif@v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: cifuzz-sarif/results.sarif
checkout_path: cifuzz-sarif
4 changes: 2 additions & 2 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
name: Coverity

# Coverity only allows a few builds per day.
# Build once at 3 AM UTC every day.
# Build once at 2 AM UTC every day.
on:
schedule:
- cron: '0 1 * * *'
- cron: '0 2 * * *'
workflow_dispatch:

jobs:
Expand Down
7 changes: 1 addition & 6 deletions fuzzing/basic_properties_directed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
#include <igraph.h>
#include <cstdlib>

inline void check_err(igraph_error_t err) {
if (err != IGRAPH_SUCCESS)
abort();
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
igraph_t graph;
igraph_vector_int_t edges;
Expand All @@ -36,7 +31,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
return 0;
}

check_err(igraph_vector_int_init(&edges, Size-1));
igraph_vector_int_init(&edges, Size-1);
for (size_t i=0; i < Size-1; ++i) {
VECTOR(edges)[i] = Data[i+1];
}
Expand Down
7 changes: 1 addition & 6 deletions fuzzing/basic_properties_undirected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
#include <igraph.h>
#include <cstdlib>

inline void check_err(igraph_error_t err) {
if (err != IGRAPH_SUCCESS)
abort();
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
igraph_t graph;
igraph_vector_int_t edges;
Expand All @@ -36,7 +31,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
return 0;
}

check_err(igraph_vector_int_init(&edges, Size-1));
igraph_vector_int_init(&edges, Size-1);
for (size_t i=0; i < Size-1; ++i) {
VECTOR(edges)[i] = Data[i+1];
}
Expand Down
20 changes: 7 additions & 13 deletions fuzzing/bliss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
#include <igraph.h>
#include <cstdlib>

inline void check_err(igraph_error_t err) {
if (err != IGRAPH_SUCCESS)
abort();
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
// Data[0] - splitting heuristic
// Data[1:] - edges
Expand All @@ -42,7 +37,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {

const igraph_integer_t max_vcount = 64;

igraph_set_error_handler(igraph_error_handler_ignore);
igraph_set_warning_handler(igraph_warning_handler_ignore);

if (Size % 2 == 0 || Size > 512+1 || Size < 1) {
Expand All @@ -55,7 +49,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {

heur = (igraph_bliss_sh_t) Data[0];

check_err(igraph_vector_int_init(&edges, Size-1));
igraph_vector_int_init(&edges, Size-1);
for (size_t i=0; i < Size-1; ++i) {
VECTOR(edges)[i] = Data[i+1];
}
Expand All @@ -65,14 +59,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (igraph_vcount(&graph) <= max_vcount) {
igraph_bool_t multi;

check_err(igraph_has_multiple(&graph, &multi));
igraph_has_multiple(&graph, &multi);

/* Bliss does not support multigraphs and the input is currently not checked */
if (! multi) {
igraph_bliss_info_t info;
igraph_vector_int_list_t generators;
check_err(igraph_vector_int_list_init(&generators, 0));
check_err(igraph_automorphism_group(&graph, nullptr, &generators, heur, &info));
igraph_vector_int_list_init(&generators, 0);
igraph_automorphism_group(&graph, nullptr, &generators, heur, &info);
igraph_free(info.group_size);
igraph_vector_int_list_destroy(&generators);
}
Expand All @@ -86,14 +80,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (igraph_vcount(&graph) <= max_vcount) {
igraph_bool_t multi;

check_err(igraph_has_multiple(&graph, &multi));
igraph_has_multiple(&graph, &multi);

/* Bliss does not support multigraphs and the input is currently not checked */
if (! multi) {
igraph_bliss_info_t info;
igraph_vector_int_list_t generators;
check_err(igraph_vector_int_list_init(&generators, 0));
check_err(igraph_automorphism_group(&graph, nullptr, &generators, heur, &info));
igraph_vector_int_list_init(&generators, 0);
igraph_automorphism_group(&graph, nullptr, &generators, heur, &info);
igraph_free(info.group_size);
igraph_vector_int_list_destroy(&generators);
}
Expand Down
11 changes: 3 additions & 8 deletions fuzzing/centrality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
#include <igraph.h>
#include <cstdlib>

inline void check_err(igraph_error_t err) {
if (err != IGRAPH_SUCCESS)
abort();
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
igraph_t graph;
igraph_vector_int_t edges;
Expand All @@ -36,7 +31,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
return 0;
}

check_err(igraph_vector_int_init(&edges, Size-1));
igraph_vector_int_init(&edges, Size-1);
for (size_t i=0; i < Size-1; ++i) {
VECTOR(edges)[i] = Data[i+1];
}
Expand All @@ -51,8 +46,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {

/* Limit graph size for the sake of performance. */
if (igraph_vcount(&graph) <= 64) {
check_err(igraph_vector_init(&v, 0));
check_err(igraph_vector_int_init(&iv, 0));
igraph_vector_init(&v, 0);
igraph_vector_int_init(&iv, 0);

igraph_betweenness_cutoff(&graph, &v, igraph_vss_all(), IGRAPH_ALL, NULL, 4);
igraph_betweenness_cutoff(&graph, &v, igraph_vss_all(), IGRAPH_IN, NULL, 5);
Expand Down
27 changes: 12 additions & 15 deletions fuzzing/community.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
#include <igraph.h>
#include <cstdlib>

inline void check_err(igraph_error_t err) {
if (err != IGRAPH_SUCCESS)
abort();
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
igraph_t graph;
igraph_vector_int_t edges;
Expand All @@ -36,7 +31,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
return 0;
}

check_err(igraph_vector_int_init(&edges, Size-1));
igraph_vector_int_init(&edges, Size-1);
for (size_t i=0; i < Size-1; ++i) {
VECTOR(edges)[i] = Data[i+1];
}
Expand All @@ -54,20 +49,22 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {

/* Limit graph size for the sake of performance. */
if (igraph_vcount(&graph) <= 64) {
check_err(igraph_matrix_int_init(&merges, 0, 0));
check_err(igraph_matrix_int_init(&im, 0, 0));
check_err(igraph_matrix_init(&mat, 0, 0));
check_err(igraph_vector_int_init(&membership, 0));
check_err(igraph_vector_int_init(&membership2, 0));
check_err(igraph_vector_int_init(&iv, 0));
check_err(igraph_vector_int_init(&iv2, 0));
check_err(igraph_vector_init(&mv, 0));
check_err(igraph_vector_init(&v, 0));
igraph_matrix_int_init(&merges, 0, 0);
igraph_matrix_int_init(&im, 0, 0);
igraph_matrix_init(&mat, 0, 0);
igraph_vector_int_init(&membership, 0);
igraph_vector_int_init(&membership2, 0);
igraph_vector_int_init(&iv, 0);
igraph_vector_int_init(&iv2, 0);
igraph_vector_init(&mv, 0);
igraph_vector_init(&v, 0);

igraph_community_label_propagation(&graph, &membership, IGRAPH_OUT, NULL, NULL, NULL);
igraph_community_walktrap(&graph, NULL, 3, &merges, &mv, &membership);
igraph_community_edge_betweenness(&graph, &iv, &v, &merges, &iv2, &mv, &membership2, IGRAPH_DIRECTED, NULL);

// Take the opportunity to run functions that can use the output of community detection.

{
igraph_community_comparison_t method[] = {
IGRAPH_COMMCMP_VI,
Expand Down
Loading

0 comments on commit b884fa2

Please sign in to comment.