Re: [BUG] Mismatch in mallinfo struct between malloc.h and _mallocr.c
Jeff Johnston <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAOox84uQqcCmdmAq2Fwd=QUWb4C8K+n1x9=ZMMv7MkrzJuy6tg@mail.gmail.com> |
Thanks Stefan. I have pushed a patch so the two structures match. -- Jeff J. On Thu, Sep 5, 2024 at 10:01 AM Stefan Baltruweit < [email protected]> wrote: > 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 > >