<p></p>
<p>We have found an issue in version 5.2<br>
To reproduce it</p>
<pre><code>$var(x) = "wg48D8NPIJ5JEfkgqhuu+Q==";
$var(decode64) = $(var(x){s.decode.base64});
$var(encode16) = $(var(decode64){s.encode.hexa});
</code></pre>
<p>after these line the value of encode16 must be 'c20e3c0fc34f209e4911f920aa1baef9'</p>
<p>Looking inside the module pv, file pv_trans.c, line 347, we realized that the code is not correct because the shift operation keeps the sign,</p>
<p><code>_tr_buffer[j++] = fourbits2char[val->rs.s[i] >> 4];</code></p>
<p>we saw that if we modifies the previous line with the following</p>
<p><code>_tr_buffer[j++] = fourbits2char[(unsigned char)(val->rs.s[i]) >> 4];</code></p>
<p>the function works as expected</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2690">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZN3LONS72SVR7OIZZ3TFM2VFANCNFSM4ZZLGXFQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZPM4LABMWWDH52CTFTTFM2VFA5CNFSM4ZZLGXF2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4MQ7P24Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2690",
"url": "https://github.com/kamailio/kamailio/issues/2690",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>