gbarr / perl-Convert-ASN1

encode/decode data using ASN.1 description
http://search.cpan.org/dist/Convert-ASN1/
13 stars 21 forks source link

memory leaks #49

Open wchristian opened 11 months ago

wchristian commented 11 months ago

i use Crypt::PKCS10, which caused some severe memory leaks from Convert::ASN1, which are partly caused by how that module uses it, i think, but could also be addressed in Convert::ASN1

please have a read of the PR and explanations here: https://github.com/openxpki/Crypt-PKCS10/pull/8

wchristian commented 11 months ago

addendum, here's a script i used to help find the causes, however ultimately fiddling with PKCS10 and devel::gladiator and devel::findref led me to my findings

https://gist.github.com/wchristian/905289b92dbd205e2e72eb293867b5a6#file-asn_leak-t

timlegge commented 11 months ago

Thanks I will take a look but happy to accept patches too.

wchristian commented 10 months ago

i just updated the patch under https://github.com/openxpki/Crypt-PKCS10/pull/8 because my initial stab at it was buggy

as for patches tim, i really don't understand the code of ASN1 and we don't use it directly, so i am happy to provide insights and answer questions, but don't feel comfortable with providing a patch for the problem of the global arrays

meanwhile i could suggest making ->find call clone on its return value before returning, but i am not sure if that is appropriate under all circumstances. what is your view on that?

timlegge commented 10 months ago

@wchristian "i really don't understand the code of ASN1 " either :-) I took on comaint when there was a security issue and no one had taken on merging a patch for a new release. At the moment I am in "caretaker role" if there are low risk changes/bug fixes I don't mind issuing a new release. I may take a look at this issue at some point but the recursive functions hurt my head...