Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# 78606af6 18-Nov-2024 Ziqing Luo <ziqing@udel.edu>

[-Wunsafe-buffer-usage] Fix bug in unsafe casts to incomplete types (#116433)

Fixed the crash coming from attempting to get size of incomplete types.
Casting `span.data()` to a pointer-to-incomplet

[-Wunsafe-buffer-usage] Fix bug in unsafe casts to incomplete types (#116433)

Fixed the crash coming from attempting to get size of incomplete types.
Casting `span.data()` to a pointer-to-incomplete-type should be
immediately considered unsafe.

Solving issue #116286.

Co-authored-by: Ziqing Luo <ziqing_luo@apple.com>

show more ...


Revision tags: llvmorg-19.1.3
# e913a33f 17-Oct-2024 Malavika Samak <malavika.samak@gmail.com>

[-Wunsafe-buffer-usage] Emit a warning if pointer returned by vector::data and array::data is cast to larger type (#111910)

Emit a warning when the raw pointer retrieved from std::vector and
std::a

[-Wunsafe-buffer-usage] Emit a warning if pointer returned by vector::data and array::data is cast to larger type (#111910)

Emit a warning when the raw pointer retrieved from std::vector and
std::array instances are cast to a larger type. Such a cast followed by
a field dereference to the resulting pointer could cause an OOB access.
This is similar to the existing span::data warning.

(rdar://136704278)

Co-authored-by: MalavikaSamak <malavika2@apple.com>

show more ...


Revision tags: llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1
# 9816863d 26-Jan-2024 Ziqing Luo <ziqing@udel.edu>

[-Wunsafe-buffer-usage] Add a new warning for uses of std::span two-parameter constructors (#77148)

Constructing `std::span` objects with the two parameter constructors
could introduce mismatched b

[-Wunsafe-buffer-usage] Add a new warning for uses of std::span two-parameter constructors (#77148)

Constructing `std::span` objects with the two parameter constructors
could introduce mismatched bounds information, which defeats the
purpose of using `std::span`. Therefore, we warn every use of such
constructors.

rdar://115817781

show more ...


Revision tags: llvmorg-19-init
# 5a7d68c8 23-Jan-2024 Danial Klimkin <dklimkin@users.noreply.github.com>

[test] Avoid libc dep in Update warn-unsafe-buffer-usage-warning-data… (#79183)

Avoid libc dep in warn-unsafe-buffer-usage-warning-data-invocation.

To keep the test hermetic. This is in line with

[test] Avoid libc dep in Update warn-unsafe-buffer-usage-warning-data… (#79183)

Avoid libc dep in warn-unsafe-buffer-usage-warning-data-invocation.

To keep the test hermetic. This is in line with other existing
declarations in the file that avoid includes.

show more ...


# 414df705 22-Jan-2024 Malavika Samak <malavika.samak@gmail.com>

[-Wunsafe-buffer-usage] Fix the crash introduced by the unsafe invocation of span::data warning (#78815)

The patch fixes the crash introduced by the DataInvocation warning
gadget designed to warn a

[-Wunsafe-buffer-usage] Fix the crash introduced by the unsafe invocation of span::data warning (#78815)

The patch fixes the crash introduced by the DataInvocation warning
gadget designed to warn against unsafe invocations of span::data method.

It also now considers the invocation of span::data method inside
parenthesis.

Radar: 121223051

---------

Co-authored-by: MalavikaSamak <malavika2@apple.com>

show more ...


# 7122f55c 02-Jan-2024 Malavika Samak <malavika.samak@gmail.com>

[-Wunsafe-buffer-usage] Warning for unsafe invocation of span::data (#75650)

…-Wunsafe-buffer-usage,

there maybe accidental re-introduction of new OutOfBound accesses into
the code bases. One su

[-Wunsafe-buffer-usage] Warning for unsafe invocation of span::data (#75650)

…-Wunsafe-buffer-usage,

there maybe accidental re-introduction of new OutOfBound accesses into
the code bases. One such case is invoking span::data() method on a span
variable to retrieve a pointer, which is then cast to a larger type and
dereferenced. Such dereferences can introduce OutOfBound accesses.

To address this, a new WarningGadget is being introduced to warn against
such invocations.

---------

Co-authored-by: MalavikaSamak <malavika2@apple.com>

show more ...