Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jun 2004 15:32:08 +0400 (MSD)
From:      Oleg Sharoiko <os@rsu.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        and@rsu.ru
Subject:   ports/67522: [PATCH] mail/pine4 has broken charset conversion in 4.60
Message-ID:  <200406031132.i53BW8S2051763@brain.cc.rsu.ru>
Resent-Message-ID: <200406031140.i53BePkE082046@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         67522
>Category:       ports
>Synopsis:       [PATCH] mail/pine4 has broken charset conversion in 4.60
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 03 04:40:24 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Oleg Sharoiko
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
Computer Center of Rostov State University
>Environment:
System: FreeBSD brain.cc.rsu.ru 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Tue May 18 18:15:48 MSD 2004 os@brain.cc.rsu.ru:/usr/obj/usr/src/sys/brain.athlon-xp.HEAD.2004-01-30 i386


	
>Description:
	Version 4.60 of Pine has a bug in conversion_table():

	unsigned short value is being assigned to unsigned char variable
	which is later compared to another unsigned short value. It's clear
	that such a comparison is almost always false as these unsigned short
	values are unicode chars from national alphabets which do not fit in
	unsigned char.

	There is also another bug:
	after the correct character in destination charset is found
	it's rather being replaced with the code of character in original
	charset. Thus the application of table created by conversion_tables
	always leaves text untouched.

	Those guys from UW shouldn't really left such a bugs in the code :(

>How-To-Repeat:
	Install pine 4.60
	Set your console to f.e. KOI8-R
	Open mailbox with a letter in windows-1251 and see it's not recoded
	pine 4.58 had no such a problem

>Fix:

	Apply the patch:
	
--- pine4/files/patch-pine::strings.c	Thu Jan  1 03:00:00 1970
+++ pine4/files/patch-pine::strings.c	Thu Jun  3 15:09:37 2004
@@ -0,0 +1,19 @@
+--- pine/strings.c	Thu Jun  3 14:59:58 2004
++++ pine/strings.c	Thu Jun  3 15:00:41 2004
+@@ -3754,7 +3754,7 @@
+ 		p = ct->table = (unsigned char *)
+ 		  fs_get(256 * sizeof(unsigned char));
+ 		for(i = 0; i < 256; i++){
+-		    unsigned char fc;
++		    unsigned short fc;
+ 		    p[i] = '?';
+ 		    switch(from->type){	/* get "from" UCS-2 codepoint */
+ 		    case CT_1BYTE0:	/* ISO 8859-1 */
+@@ -3789,7 +3789,6 @@
+ 			}
+ 			break;
+ 		    }
+-		    p[i] = i;
+ 		}
+ 		break;
+ 	    }
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406031132.i53BW8S2051763>