Skip to content

Commit

Permalink
Improvement the int conversion overflow logic to handle bound checks (#…
Browse files Browse the repository at this point in the history
…1194)

* add test cases

Signed-off-by: czechbol <[email protected]>

* fix bounds check logic

Signed-off-by: czechbol <[email protected]>

* tweak test cases

Signed-off-by: czechbol <[email protected]>

* fix codestyle

Signed-off-by: czechbol <[email protected]>

* improve bounds check logic

Signed-off-by: czechbol <[email protected]>

* max recursion depth

Signed-off-by: czechbol <[email protected]>

* add test case for len function

Signed-off-by: czechbol <[email protected]>

* relax len function bounds checks

Co-authored-by: Ben Krieger <[email protected]>

* handle cases when convert instruction is after the if blocks

Signed-off-by: czechbol <[email protected]>

* improve range check discovery, add tests

Signed-off-by: czechbol <[email protected]>

* refactor for readability

Signed-off-by: czechbol <[email protected]>

* add cap function test

Signed-off-by: czechbol <[email protected]>

* calculate signed min without throwing overflow warnings

Signed-off-by: czechbol <[email protected]>

* perform bounds checks int size calculations

Signed-off-by: czechbol <[email protected]>

* basic equal operator logic

Signed-off-by: czechbol <[email protected]>

* uintptr -> unsafe.Pointer test case

Signed-off-by: czechbol <[email protected]>

* fix review comments

Signed-off-by: czechbol <[email protected]>

* Rebase and fix go module

Change-Id: I8da6495eaaf25b1739389aa98492bd7df338085b
Signed-off-by: Cosmin Cojocar <[email protected]>

* fix false positive for negated value

Signed-off-by: czechbol <[email protected]>

* fix range conditions

Signed-off-by: czechbol <[email protected]>

* Ignore the golangci/gosec G115 warning

Change-Id: I0db56cb0a5f9ab6e815e2480ec0b66d7061b23d3
Signed-off-by: Cosmin Cojocar <[email protected]>

---------

Signed-off-by: czechbol <[email protected]>
Signed-off-by: Cosmin Cojocar <[email protected]>
Co-authored-by: Ben Krieger <[email protected]>
Co-authored-by: Cosmin Cojocar <[email protected]>
  • Loading branch information
3 people authored Sep 4, 2024
1 parent ea5b276 commit eaedce9
Show file tree
Hide file tree
Showing 5 changed files with 832 additions and 65 deletions.
Loading

0 comments on commit eaedce9

Please sign in to comment.