Menu

#2 Bug with "A(S(c#)s)" (with patch)

open
nobody
None
5
2012-08-22
2009-10-21
Eric Rose
No

First let me say how great TPL is, I really like using it. (I wish it were easier to debug, though :-)

I have found a bug with using the following: "A(S(c#)s)". The test code crashes in tpl_free().

I tracked the problem down to a missing num multiplier in the free function. Here is the patch:

*** 1555,1561
case TPL_TYPE_UINT64:
case TPL_TYPE_INT16:
case TPL_TYPE_UINT16:
! dv = (void
)((long)dv + tpl_types[c->type].sz);
break;
case TPL_TYPE_BIN:
memcpy(&binp,dv,sizeof(tpl_bin
)); /
cp to aligned
/
--- 1555,1561 ----
case TPL_TYPE_UINT64:
case TPL_TYPE_INT16:
case TPL_TYPE_UINT16:
! dv = (void)((long)dv + tpl_types[c->type].sz * c->num);
break;
case TPL_TYPE_BIN:
memcpy(&binp,dv,sizeof(tpl_bin
)); / cp to aligned /

You might want to add a test case for this one.

Best wishes!

Discussion

Anonymous
Anonymous

Add attachments
Cancel