Skip to content

Commit

Permalink
protect profiles entry
Browse files Browse the repository at this point in the history
  • Loading branch information
dk committed Oct 30, 2023
1 parent ab9479a commit c60ab0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion img/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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 )
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion pod/Prima/image-load.pod
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ Default: 0

=head2 WebP codec

=head3 Load input
=head3 Load output

=over

Expand Down

0 comments on commit c60ab0c

Please sign in to comment.