Bug 509139 - Update BadSize error messages
Summary: Update BadSize error messages
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (other bugs)
Version First Reported In: 3.25 GIT
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-05 08:07 UTC by Paul Floyd
Modified: 2025-09-07 20:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Initial patch only tested on FreeBSD (13.13 KB, patch)
2025-09-07 19:25 UTC, Paul Floyd
Details
Updated for Linux (14.29 KB, patch)
2025-09-07 19:47 UTC, Paul Floyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Floyd 2025-09-05 08:07:40 UTC
The message is currently something like

memalign() invalid size value: 0

For consistency I think that should be something like

Invalid size value: 0 (memalign() size of 0 is implementation defined)

At present 4 functions are affected
posix_memalign - implementation defined by POSIX
memalign - non-standard that can and does do just about anything
aligned_alloc - implementation defined by ISO C which passes the buck and says it is implementation defined
free_sized_aligned - can't remember why I did this (but I didn't do free_sized)

I need to revisit my research into what all these functions do on new glibc, old glibc, FreeBSD, Solaris, macOS, musl, ptmalloc and maybe a couple more.
Comment 1 Paul Floyd 2025-09-07 09:15:31 UTC
I've done a load of tests for size of zero add alignment of zero

https://github.com/paulfloyd/aligned_errors

and pushed a few fixes to the code.

I don't think that I checked whether posix_memalign allocates or not with a size of zero.
Comment 2 Paul Floyd 2025-09-07 19:25:47 UTC
Created attachment 184792 [details]
Initial patch only tested on FreeBSD

Need tol check on Linux and illumos
Comment 3 Paul Floyd 2025-09-07 19:47:54 UTC
Created attachment 184793 [details]
Updated for Linux

next stop illumos
Comment 4 Paul Floyd 2025-09-07 20:04:28 UTC
commit 66f0174466cd0d97d1b123ac8152797fb34aeb8c (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Sun Sep 7 22:01:34 2025 +0200

    Bug 509139 - Update BadSize error messages