[all-commits] [llvm/llvm-project] 7ce828: [libc++] Fix realloc bug in ios.cpp (#177526)

v-zhangxiaomeng5 via All-commits all-commits at lists.llvm.org
Fri Apr 17 08:27:01 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ce828298b4882c12f8218f37159b3df2be036f3
      https://github.com/llvm/llvm-project/commit/7ce828298b4882c12f8218f37159b3df2be036f3
  Author: v-zhangxiaomeng5 <v-zhangxiaomeng5 at xiaomi.com>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M libcxx/src/ios.cpp

  Log Message:
  -----------
  [libc++] Fix realloc bug in ios.cpp (#177526)

When realloc fails in the function register_callback in `ios.cpp`, the
memory will be leaked, then `__fn_` is assigned as `nullptr`,
dereferencing `__fn_` causes UB. The fix is quite simple which aligns to
`iword & pword` for `realloc`, i.e. return directly if `realloc` fails.

Regarding testing for this bug fix, because `realloc` is a C function
that we can't replace, there is no way to exercise that path easily.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list