Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Apr 2002 14:40:20 -0700 (PDT)
From:      Fuyuhiko Maruyama <fuyuhik8@is.titech.ac.jp>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/37543: libiconv run into endless loop during making security/gpgme.
Message-ID:  <200204282140.g3SLeKA53232@freefall.freebsd.org>

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

>Number:         37543
>Category:       ports
>Synopsis:       libiconv run into endless loop during making security/gpgme.
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 28 14:50:03 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Fuyuhiko Maruyama
>Release:        FreeBSD 4.5-STABLE
>Organization:
Tokyo Institute of Technology
>Environment:
FreeBSD guns.private 4.5-STABLE FreeBSD 4.5-STABLE #1: Mon Apr 29 01:48:04 JST 2002     maruyama@guns.private:/usr/obj/usr/src/sys/GUNS  i386
    
>Description:
When libiconv fail text conversion, it may run into
endless loop (not always).

The problem is caused by libiconv's odd error handling. There 
is some program points where error code is silently changed,
RET_ILUNI to RET_TOOSMALL.  Since RET_TOOSMALL means no
sufficient buffer memory, libiconv try to enlarge buffer and
retry conversion.  Because of this nature, silently changed
error code causes endless loop of (enlarge buffer -> retry).
>How-To-Repeat:
1. setenv LANG ja_JP.eucJP
2. cd /usr/ports/gpgme
3. make

It may be a locale dependent problem and I only know it
appears when I set LANG=ja_JP.eucJP.

>Fix:
Although I met the problem when I make security/gpgme, the
actual problem is in converters/libiconv.

Here is a patch to fix libiconv.
I'm sorry to paste it from send-pr's web interface, I know
it breaks patch ;-<.

--- lib/loop_unicode.h.orig     Fri Jun  8 22:04:33 2001
+++ lib/loop_unicode.h  Mon Apr 29 05:12:08 2002
@@ -52,8 +52,7 @@
       cd->ostate = backup_state;
       outptr = backup_outptr;
       outleft = backup_outleft;
-      if (sub_outcount < 0)
-        return RET_TOOSMALL;
+      return sub_outcount;
     }
   }
   {
@@ -96,8 +95,7 @@
           cd->ostate = backup_state;
           outptr = backup_outptr;
           outleft = backup_outleft;
-          if (sub_outcount < 0)
-            return RET_TOOSMALL;
+         return sub_outcount;
         }
         if (last)
           break;
@@ -144,8 +142,7 @@
       cd->ostate = backup_state;
       outptr = backup_outptr;
       outleft = backup_outleft;
-      if (sub_outcount < 0)
-        return RET_TOOSMALL;
+      return sub_outcount;
     }
   }
   return RET_ILUNI;

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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