Skip to content

Conversation

@devnexen
Copy link
Contributor

@devnexen devnexen commented Jun 4, 2022

Linux/glibc supports it and has its related __libc_reallocarray anchor too.

@struct
Copy link
Owner

struct commented Jun 4, 2022

Can you run make format?

Linux/glibc supports it and has its related __libc_reallocarray anchor too.
@struct struct merged commit c01d0c6 into struct:master Jun 4, 2022
@struct struct mentioned this pull request Jun 4, 2022
@jvoisin
Copy link
Contributor

jvoisin commented Jun 4, 2022

What's the point of adding this? reallocarray is already safely failing in case of overflows, and if isoalloc is used, odds are that reallocarray will simply call iso_alloc/iso_free or iso_realloc.

@struct
Copy link
Owner

struct commented Jun 5, 2022

What's the point of adding this? reallocarray is already safely failing in case of overflows, and if isoalloc is used, odds are that reallocarray will simply call iso_alloc/iso_free or iso_realloc.

Not sure I understand @jvoisin, are you asking what the point of adding the documentation is? I think every interface exported via EXTERNAL_API should be documented for completeness. If someone is performing an automated codemod from libc interfaces to isoalloc they should know which interfaces are available and which are not. Ideally its a 1:1 match.

@jvoisin
Copy link
Contributor

jvoisin commented Jun 7, 2022

No, I'm asking what is the point of adding a realloc implementation to isoalloc.

@struct
Copy link
Owner

struct commented Jun 11, 2022

@jvoisin got it. If someone decides to use isoalloc (and not LD_PRELOAD it) and switches all their calls from malloc/free to iso_alloc/iso_free they will also need to change their calls to reallocarray calls as well, otherwise it will call the system realloc/malloc. We should strive for complete interface parity to libc when it comes to malloc(). There are probably other corner cases and interfaces we are missing here.

@jvoisin
Copy link
Contributor

jvoisin commented Jun 12, 2022

Oh, now I understand the point of have reallocarray in isoalloc, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants