about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-22 17:01:17 +0000
committerbors <bors@rust-lang.org>2023-12-22 17:01:17 +0000
commite0b25c5a648a0d60f8efdae00c9740785e918350 (patch)
treec6467fe51ca0f9dd16525d8820f384f1a3fff19f /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
parentdc975266a95ed723e51d4ee088e5726cfb2898be (diff)
parent18eb406776a0d977c633283a15a970eaec64ddbb (diff)
downloadrust-e0b25c5a648a0d60f8efdae00c9740785e918350.tar.gz
rust-e0b25c5a648a0d60f8efdae00c9740785e918350.zip
Auto merge of #11998 - cocodery:fix/issue11762, r=llogiq
Check whether out of bound when access a known length array with a constant index

fixes [Issue#11762](https://github.com/rust-lang/rust-clippy/issues/11762)

Issue#11762 points that `Array references with known length are not flagged when indexed out of bounds`.

To fix this problem, it is needed to add check for `Expr::Index`. We expand this issue include reference and direct accessing a array.

When we access a array with a constant index `off`, and already know the length `size`, if `off >= size`, these code will throw an error, instead rustc's lint checking them or runtime panic happening.

changelog: [`out_of_bound_indexing`]: Add check for illegal accessing known length array with a constant index
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions