<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 05/16/2012 03:02 PM, Charles Chance wrote:
<blockquote cite="mid:E1SUcy8-0002DM-Jg@www.kamailio.org"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 11 (filtered
medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Times New\000D\000A Roman";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"
cite="mid:4fb2d24d.0e34d80a.1a78.ffff8c81SMTPIN_ADDED@mx.google.com"
type="cite">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"
cite="mid:4fb227d5.0550d80a.411f.ffff86a8SMTPIN_ADDED@mx.google.com"
type="cite">
<p class="MsoNormal"><font color="black" face="Arial"
size="2"><span style="font-size:
10.0pt;font-family:Arial">Currently testing devel
version and experiencing the
following when using pua_dialoginfo:<u1:p></u1:p></span></font><u5:p></u5:p><o:p></o:p></p>
<p class="MsoNormal"><font color="black" face="Arial"
size="2"><span style="font-size:
10.0pt;font-family:Arial"><u1:p> </u1:p></span></font><u5:p></u5:p><o:p></o:p></p>
<p class="MsoNormal"><font color="black" face="Arial"
size="2"><span style="font-size:
10.0pt;font-family:Arial">-------------------------------------<u1:p></u1:p></span></font><u5:p></u5:p><o:p></o:p></p>
<p class="MsoNormal"><font color="black" face="Arial"
size="2"><span style="font-size:
10.0pt;font-family:Arial">Program terminated with
signal 11, Segmentation fault.<u1:p></u1:p></span></font><u5:p></u5:p><o:p></o:p></p>
<p class="MsoNormal"><font color="black" face="Arial"
size="2"><span style="font-size:
10.0pt;font-family:Arial">#0 core_hash (t=0xb3d7e330,
type=1024,
ps=0xbfcc31c8) at ../../hashes.h:279<u1:p></u1:p></span></font><u5:p></u5:p><o:p></o:p></p>
<p class="MsoNormal"><font color="black" face="Arial"
size="2"><span style="font-size:
10.0pt;font-family:Arial">279
v=(*p<<24)+(p[1]<<16)+(p[2]<<8)+p[3];<u1:p></u1:p></span></font><u5:p></u5:p><o:p></o:p></p>
<font color="black" face="Times New Roman" size="3"><span
style="font-size:12.0pt"></span></font><br>
</blockquote>
</blockquote>
</div>
</blockquote>
Hello, <br>
Don't know if this is related, but the statement above hides a nasty
bug: p[1] is a char (as for the description), so is signed, shifting
to the left 16 bits is ok, as an integral promotion takes place. The
problem is that if p[1] is negative (-1 is 0xff), then the integral
promotion is signed as well and is complementary of 2 (or whatever
the implementation considers), and the shift will return another
value as expected.<br>
<br>
For example :<br>
#include <stdio.h><br>
<br>
int main(){<br>
char b = 0xff;<br>
unsigned h = (b<<16);<br>
printf("%x\n", h);<br>
return 0;<br>
}<br>
<br>
will print ffff0000 instead of ff0000 as expected. Haven't
calculated the implication of this related to the bug. An fix would
be to cast p[1] to (unsigned char)<br>
<br>
Cheers,<br>
Marius<br>
<br>
<br>
<font color="black" face="Arial" size="2"><span style="font-size:
10.0pt;font-family:Arial"></span></font><br>
<br>
<pre class="moz-signature" cols="72">--
Zbihlei Marius
Head of
Linux Development Services Romania
1&1 Internet Development srl Tel KA: 754-9152
Str Mircea Eliade 18 Tel RO: +40-31-223-9152
Sect 1, Bucuresti mailto: <a class="moz-txt-link-abbreviated" href="mailto:marius.zbihlei@1and1.ro">marius.zbihlei@1and1.ro</a>
71295, Romania
</pre>
</body>
</html>