[BUG] Mismatch in mallinfo struct between malloc.h and _mallocr.c
Stefan Baltruweit <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <BEUP281MB37299075D0C39D06E86B1243999D2@BEUP281MB3729.DEUP281.PROD.OUTLOOK.COM> |
Hi Newlib Developers, I would like to report a potential issue in Newlib libc related to a mismatch in `mallinfo` struct definitions. **Issue Summary**: - In `libc/include/malloc.h` (struct `mallinfo`), the member type is defined as `size_t`. - In `libc/stdlib/_mallocr.c` (struct `mallinfo`), the member type is defined as `int`. On platforms where `size_t` and `int` are of different sizes, this leads to a misinterpretation of the pointer returned by `mallinfo()`. On platforms where `size_t` and `int` are the same size, the sign mismatch will typically not be noticeable. **Version/Environment**: - Newlib Version: 2.2.0 - present - This is the potential breaking change: https://inbox.sourceware.org/newlib-cvs/[email protected]/T/ Please let me know if further information required. Best regards, Stefan Baltruweit