Skip to content

Commit

Permalink
Add support for checking for overflows (#22)
Browse files Browse the repository at this point in the history
* add overflow flag

* fix termination checking
  • Loading branch information
jcp19 authored Feb 14, 2024
1 parent 5889863 commit 829a3bd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
description: 'Verify nested packages recursively'
required: false
default: '0'
overflow:
description: 'Check for arithmetic overflows in integer expressions.'
required: false
default: '0'
chop:
description: 'Maximum number of files in which a file can be split with the chopper feature of Gobra. Larger values may improve the verification time of large codebases.'
default: '1'
Expand Down
4 changes: 4 additions & 0 deletions docker-action/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ if [[ $INPUT_CONDITIONALIZEPERMISSIONS -eq 1 ]]; then
GOBRA_ARGS="$GOBRA_ARGS --conditionalizePermissions"
fi

if [[ $INPUT_OVERFLOW -eq 1 ]]; then
GOBRA_ARGS="$GOBRA_ARGS --overflow"
fi

if [[ $INPUT_STATSFILE ]]; then
# We write the file to /tmp/ (which is easier then making gobra write directly
# to the STATS_TARGET, as doing so often causes Gobra to not generate a file) due
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export STATS_TARGET="/stats/"

echo "Run Docker Action container"
docker run -e INPUT_CACHING -e INPUT_PROJECTLOCATION -e INPUT_INCLUDEPATHS -e INPUT_FILES -e INPUT_PACKAGES -e INPUT_EXCLUDEPACKAGES -e INPUT_CHOP \
-e INPUT_VIPERBACKEND -e INPUT_JAVAXSS -e INPUT_JAVAXMX -e INPUT_TIMEOUT -e INPUT_HEADERONLY -e INPUT_STATSFILE \
-e INPUT_OVERFLOW -e INPUT_VIPERBACKEND -e INPUT_JAVAXSS -e INPUT_JAVAXMX -e INPUT_TIMEOUT -e INPUT_HEADERONLY -e INPUT_STATSFILE \
-e INPUT_MODULE -e INPUT_RECURSIVE -e INPUT_ASSUMEINJECTIVITYONINHALE -e INPUT_CHECKCONSISTENCY -e INPUT_MCEMODE \
-e INPUT_REQUIRETRIGGERS \
-e INPUT_PARALLELIZEBRANCHES -e INPUT_CONDITIONALIZEPERMISSIONS -e GITHUB_WORKSPACE -e GITHUB_REPOSITORY \
Expand Down
3 changes: 2 additions & 1 deletion test/files_test/file2.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func sum(n int) (sum int) {
}

ensures res == (n % 2 == 0)
decreases
pure func isEven(n int) (res bool) {
return n % 2 == 0
}
Expand All @@ -30,4 +31,4 @@ func halfRoundedUp(n int) (res int) {
res = n / 2 + 1
}
return res
}
}

0 comments on commit 829a3bd

Please sign in to comment.