Repository navigation
Conversation
|
@rainer-tammer Could you please check whether the fix in this PR works for you? |
sjaeckel
left a comment
There was a problem hiding this comment.
Can't we simply re-define XMALLOC on AIX to malloc((len) + 1) or if we're worried this might overflow to
({
void *LTC_TMPVAR(p);
size_t LTC_TMPVAR(tlen) = (len);
LTC_TMPVAR(p) = malloc(LTC_TMPVAR(tlen) ? LTC_TMPVAR(tlen) : 1);
LTC_TMPVAR(p);
})
instead of doing this for each architecture?
|
I don't have a strong opinion here. I just don't want to add AFAIK, it's "legal" for malloc(0) to return either NULL or a valid pointer and our code should handle both correctly. |
I also wouldn't want to make this arch specific, since it's toolchain and C standard version specific ... reading the malloc manpage is real fun ... m( The question becomes: Should we try to fix this in a future-proof way or simply slap this patch on and fix any potential wrong usages in the future when they happened? After looking at the "either do this or do something entirely different." |
|
With the following patch the malloc patch (#810, pr/aix-fixes) does work with perl-CryptX (no AIX #ifdef).
|
Just to be sure: you meant |
|
Sorry, yes I meant pr/aix-failures. |
|
I am not sure about implementing future-proof wrappers; we have three occurrences here. Maybe improved comment: buf = XMALLOC(buf_len ? buf_len : 1); /* 0 is valid for buf_len; XMALLOC(0) may return NULL */Or simpler: buf = XMALLOC(buf_len + 1); /* 0 is valid for buf_len; XMALLOC(0) may return NULL */ |
|
Looks good. |
I'll have a look after this is decided upon.
I'm also not so sure whether I'd want them, but I don't know whether we can solve this properly without ...
which could overflow to 0 in theory!? |
|
Good. |
|
Any news regarding perl-CryptX src/ltc/math/ltm_desc.c (src/math/ltm_desc.c, libtomcrypt)? |
alternative fix for #810