Subject: pkg/35825: devel/libosip2-2.2.2 has 64-bit unclean bug [with patch]
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Rhialto <rhialto@falu.nl>
List: pkgsrc-bugs
Date: 02/24/2007 11:50:00
>Number:         35825
>Category:       pkg
>Synopsis:       devel/libosip2-2.2.2 has 64-bit unclean bug [with patch]
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 24 11:50:00 +0000 2007
>Originator:     Rhialto
>Release:        NetBSD 3.0
>Organization:
	
>Environment:
System: NetBSD radl.falu.nl 3.0 NetBSD 3.0 (Radls Doordringend Onjuiste Akkoord) #1: Thu Sep 14 02:39:33 CEST 2006 root@radl.falu.nl:/usr/src/sys/arch/amd64/compile/RADL amd64
Architecture: x86_64
Machine: amd64
>Description:
	There is a hash function that returns "unsigned long" but its
	return values are compared with 32-bit values.

	I have reported the bug upstream, but the next versions up to
	at least 3.0.1 do contain the problem.

>How-To-Repeat:
	Try to use wip/siproxd (which uses this library) on an amd64,
	and be surprised that it complains about missing header fields
	(which are retrieved via hashing).
>Fix:

	Add this patch file:
	
--- src/osipparser2/osip_port.c.orig	2006-12-20 21:11:55.000000000 +0100
+++ src/osipparser2/osip_port.c	2006-12-20 21:09:30.000000000 +0100
@@ -1091,7 +1091,7 @@
   while (c = *str++)
     hash = ((hash << 5) + hash) + c;
 
-  return hash;
+  return hash & 0xFFFFFFFFu;
 }
 
 /* ---For better performance---

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.