Landing: c1aa090bb8e1
Project / Subsystem
gcc / strlen
Date
2026-05-01
Author
Jakub Jelinek
Commit
c1aa090bb8e1c23e733bc7beafceb7c34dc713f8
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- strlen
- patch_id
- —
- commit_hash
- c1aa090bb8e1c23e733bc7beafceb7c34dc713f8
- source_type
- github
- headline
- Adjust objsz Arg in __strcat_chk -> __stpcpy_chk Transformation
- tldr
- The compiler now correctly transforms calls to `__strcat_chk` into calls to `__stpcpy_chk` when optimizing `strlen`, avoiding potential buffer overflows.
- author
- Jakub Jelinek
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • security
- • string
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-01T00:00:00.000Z
This commit addresses an issue in the transformation of __strcat_chk calls during strlen optimization. When the compiler optimizes code that calls strlen after __strcat_chk, it transforms the __strcat_chk call into a call to __stpcpy_chk. The change ensures that the objsz argument (object size) passed to __stpcpy_chk is correctly adjusted, preventing potential buffer overflows.