diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-09-24 13:20:35 -0400 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2024-09-24 14:54:55 -0400 |
| commit | c51d8ff458e00b34e03b1fd5ac9bb0665c5a516a (patch) | |
| tree | 73bdb63c561e50c7556e69531396da50797f6980 /array.c | |
| parent | 4f0fe97995cef41a36a229b0ace89263c4e3224f (diff) | |
Fix undefined behavior in String#append_as_bytes
The UNREACHABLE macro calls __builtin_unreachable, which according to
the [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005funreachable):
> If control flow reaches the point of the __builtin_unreachable, the
> program is undefined.
But it can reach this point with the following script:
"123".append_as_bytes("123")
This can crash on some platforms with a `Trace/BPT trap: 5`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11678
Diffstat (limited to 'array.c')
0 files changed, 0 insertions, 0 deletions
