[ldns-users] a bug in pyldns

Bedrich Kosata bedrich.kosata at nic.cz
Wed Mar 16 19:21:52 UTC 2011


Hi everybody,

two of my students found another problem with the pyldns bindings. The 
function ldns.ldns_rr.new_frm_fp (ldns_rr_new_frm_fp_l_ in the raw 
wrapper) does not properly increment reference count on Py_None. This 
results in erroneous deallocation and after this function is used 
repeatedly for some time, the program crashes with "Fatal Python error: 
deallocating None" (the refcount for None reaches 0).
This problem is remedied by the attached patch against ldns-1.6.9 (I am 
sorry I did not make it before the release :)). For good measure, I 
applied the same treatment to two other functions (ldns_rr_new_frm_str_, 
ldns_rr_new_question_frm_str_) where the same problem appeared.

With best regards

Beda


p.s.- here is a simple test program to reproduce the crash in 
ldns_rr_new_frm_str_

-------------
import ldns
import sys

while True:
   print sys.getrefcount(None)
   ldns.ldns_rr.new_frm_str("www.nic.cz. IN A 192.168.1.1",300)
-------------

In the fixed state, it should run indefinitely.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ldns.i.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20110316/21d72b53/attachment.bin>


More information about the ldns-users mailing list