From c60ab0cc8d31815bc87f6616d57e2cbdfbe55dc9 Mon Sep 17 00:00:00 2001 From: Dmitry Karasik Date: Mon, 30 Oct 2023 15:24:22 +0100 Subject: [PATCH] protect profiles entry --- img/load.c | 6 +++++- pod/Prima/image-load.pod | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/img/load.c b/img/load.c index 088ca0a55..b1c26964f 100644 --- a/img/load.c +++ b/img/load.c @@ -406,6 +406,7 @@ apc_img_open_load( Handle self, char * fileName, Bool is_utf8, PImgIORequest ior if ( SvOK( sv) && SvROK( sv) && SvTYPE( SvRV( sv)) == SVt_PVAV) { fi-> profiles = ( AV *) SvRV( sv); fi-> profiles_len = av_len( fi->profiles); + SvREFCNT_inc((SV*) fi->profiles); } else out("Not an array passed to 'profiles' property"); } @@ -691,6 +692,7 @@ apc_img_load_next_frame( Handle target, PImgLoadFileInstance fi, HV * profile, c } sv_free(( SV *) fi-> frameProperties); + fi-> frameProperties = NULL; if ( firstObjectExtras) (void) hv_store( firstObjectExtras, "frames", 6, newSViv( fi->frameCount), 0); fi->current_frame++; @@ -718,6 +720,8 @@ void apc_img_close_load( PImgLoadFileInstance fi ) { PImgCodec c = fi->codec; + if ( fi->profiles) + SvREFCNT_dec((SV*) fi->profiles); if ( fi-> baseClassName ) free( fi-> baseClassName ); if ( fi->instance ) @@ -741,7 +745,7 @@ apc_img_load( Handle self, char * fileName, Bool is_utf8, PImgIORequest ioreq, PImgLoadFileInstance fi; if ( !( ret = plist_create( 8, 8))) { - if ( error ) strcpy( error, "Nor enough memory"); + if ( error ) strcpy( error, "Not enough memory"); return NULL; } diff --git a/pod/Prima/image-load.pod b/pod/Prima/image-load.pod index c23a1d241..43c109905 100644 --- a/pod/Prima/image-load.pod +++ b/pod/Prima/image-load.pod @@ -1194,7 +1194,7 @@ Default: 0 =head2 WebP codec -=head3 Load input +=head3 Load output =over