Commit 60801b2bba for perl
commit 60801b2bbaf89c907cb21ba6a8ccc10ba9a056ab
Author: Dina Tagantseva <dinchik@altlinux.org>
Date: Thu Sep 17 15:32:54 2026 +0300
newAVav: check oav for NULL before dereferencing it
Сrashed instead of returning an empty AV. Move the check first,
as newAVhv() already does.
Signed-off by: Dina Tagantseva <dinchik@altlinux.org>
diff --git a/av.c b/av.c
index 46fa03f59e..697cda8203 100644
--- a/av.c
+++ b/av.c
@@ -534,9 +534,12 @@ Perl_newAVav(pTHX_ AV *oav)
{
PERL_ARGS_ASSERT_NEWAVAV;
+ if(UNLIKELY(!oav))
+ return newAV();
+
Size_t count = av_count(oav);
- if(UNLIKELY(!oav) || count == 0)
+ if(count == 0)
return newAV();
AV *ret = newAV_alloc_x(count);