[libcxx-commits] [libcxx] [libc++][hardening] Enable comparator checks for safe mode too (PR #66458)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 18 05:40:49 PDT 2023


ldionne wrote:

> What are the implications of a bad comparator? Could it cause an algorithm to go off the rails in an unsafe way, e.g. returning an out-of-bounds element, or would it "just" lead to returning an incorrect result (or fail to return)?

Potential OOBs should be caught by other checks that are enabled in the safe mode. This is the case of the `sort` algorithm for example: if you pass an invalid comparator, it could try to go OOB but we added additional checks to ensure that it didn't happen.

https://github.com/llvm/llvm-project/pull/66458


More information about the libcxx-commits mailing list