Austin Group Defect Tracker

Aardvark Mark III

Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001218 [1003.1(2013)/Issue7+TC1] System Interfaces Editorial Enhancement Request 2018-12-08 21:03 2019-06-26 18:52
Reporter alanc View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Alan Coopersmith
Organization Oracle Solaris Engineering
User Reference
Section reallocarray
Page Number (page or range of pages)
Line Number (Line or range of lines)
Interp Status ---
Final Accepted Text
Summary 0001218: Add reallocarray()
Description OpenBSD created a reallocarray() function to offer overflow checking for array size calculations in the library instead of every caller: [^] defines it as:

  void *reallocarray(void *ptr, size_t nmemb, size_t size);

  Designed for safe allocation of arrays, the reallocarray() function is
  similar to realloc() except it operates on /nmemb/ members of size /size/
  and checks for integer overflow in the calculation /nmemb/ * /size/.

Other platforms have since adopted it, including GNU libc in version 2.26.
Desired Action Add reallocarray() interface in the next edition of the standards.
Tags No tags attached.
Attached Files

- Relationships

-  Notes
schwarze (reporter)
2018-12-09 02:09

Here is the authoritative manual page: [^]

Supplementary information about systems already implementing this interface:

FreeBSD provides it for three years now: [^]

NetBSD also provides it for three years: [^]

illumos provides it since last year: [^]

The NetBSD implementation suffers from hiding it behind _OPENBSD_SOURCE even though it is no longer OpenBSD-specific for quite some time now. That sometimes causes issues in build systems like automatic configuration tests not finding it with subsequent symbol clashes between the libc symbol and a replacement implementation that the build system included. Including the function in the standard might convince NetBSD to no longer hide their implementation, making life easier for people who try to design portable build systems.
alanc (reporter)
2019-06-26 18:52

Also now in Solaris 11.4.10 & later: [^]

- Issue History
Date Modified Username Field Change
2018-12-08 21:03 alanc New Issue
2018-12-08 21:03 alanc Name => Alan Coopersmith
2018-12-08 21:03 alanc Organization => Oracle Solaris Engineering
2018-12-08 21:03 alanc Section => reallocarray
2018-12-08 21:03 alanc Page Number => (page or range of pages)
2018-12-08 21:03 alanc Line Number => (Line or range of lines)
2018-12-09 02:09 schwarze Note Added: 0004175
2019-06-26 18:52 alanc Note Added: 0004453

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker