Repository navigation
Fix aliasing-based undefined behavior in string functions. - #11215
Conversation
3e15038 to
c0f4cb6
Compare
|
Can you mention this in |
Copies these functions verbatim from musl v1.2.0. Also adds weak_alias macro to features.h to reflect upstream musl.
Added |
| #endif | ||
|
|
||
| #define weak_alias(old, new) \ | ||
| extern __typeof(old) new __attribute__((__weak__, __alias__(#old))) |
There was a problem hiding this comment.
This looks like its already defined in src/internal/libc.h.. And in upstream musl it moved to the internal header src/include/features.h (as opposed to this features.h header which is externally visible).
Is this a necessary part of the change? Do the sources in string not already include src/internal/libc.h?
I wonder if its worth bringing over the new src/include/features.h wrapper header?
There was a problem hiding this comment.
Well, you nerd-sniped me. I am seeing how much v1.2.0 I can pull in here.
There was a problem hiding this comment.
If possible I'd recommend keeping this change focused, unless you want to do a full musl upgrade .. which is quite a big endeavor. (I think it took weeks or maybe months to completely last time it was done).
There was a problem hiding this comment.
I agree, let's land this now, but @zekoz please submit more PRs with more 1.2 pieces or even the whole upgrade!
This was added in #11215 to maintain comatability with upgraded version of stpcpy.c/stpncpy.c/strchrnul.c. However, this macro was never indended to exposed outside of musl itself. In musl v1.2.2 this macro lives in the *internal* version of features.h but musl v1.1.15 does't have an internal features.h. Instead this macro lives in libc.h in v1.1.15. See: #14352 Fixes: #14350
This was added in #11215 to maintain comatability with upgraded version of stpcpy.c/stpncpy.c/strchrnul.c. However, this macro was never indended to exposed outside of musl itself. In musl v1.2.2 this macro lives in the *internal* version of features.h but musl v1.1.15 does't have an internal features.h. Instead this macro lives in libc.h in v1.1.15. See: #14352 Fixes: #14350
Copies these functions verbatim from musl v1.2.0. #10910 #7279