[Debian-hebrew-package] [svn] r310 - pkg/bidiv/branches/upstream/current

Lior Kaplan kaplan-guest at costa.debian.org
Sat Jan 7 21:02:26 UTC 2006


Author: kaplan-guest
Date: Sat Jan  7 21:02:22 2006
New Revision: 310

Added:
   pkg/bidiv/branches/upstream/current/COPYING
Removed:
   pkg/bidiv/branches/upstream/current/COMPILE
   pkg/bidiv/branches/upstream/current/bidiv.spec
Modified:
   pkg/bidiv/branches/upstream/current/README
   pkg/bidiv/branches/upstream/current/WHATSNEW
   pkg/bidiv/branches/upstream/current/bidiv.1
   pkg/bidiv/branches/upstream/current/bidiv.c
Log:
Load /tmp/tmp.12pydy/bidiv-1.5 into
pkg/bidiv/branches/upstream/current.


Modified: pkg/bidiv/branches/upstream/current/README
==============================================================================
--- pkg/bidiv/branches/upstream/current/README	(original)
+++ pkg/bidiv/branches/upstream/current/README	Sat Jan  7 21:02:22 2006
@@ -10,9 +10,9 @@
 
 This is why I wrote a very simple program based on Fribidi, that acts as a
 filter or viewer (with similar semantics as the 'cat' command) for logical-
-order ISO-8859-8 files: The logical ISO-8859-8 is converted to visual
-ISO-8859-8 assuming a fixed number of characters per line (automatically
-determined or given with the -w parameter).
+order ISO-8859-8 or UTF8 files: The logical text is converted to visual
+ISO-8859-8 (or UTF8) assuming a fixed number of characters per line
+(automatically determined or given with the -w parameter).
 
 I called this program 'bidiv', for "bidi viewer". You can get it in
 ftp://ftp.ivrix.org.il/pub/ivrix/src/cmdline/bidiv-1.0.tgz
@@ -29,5 +29,5 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (c) 2001 Nadav Har'El
-License: GNU General Public License
+Copyright (c) 2001-2006 Nadav Har'El
+License: GNU General Public License version 2

Modified: pkg/bidiv/branches/upstream/current/WHATSNEW
==============================================================================
--- pkg/bidiv/branches/upstream/current/WHATSNEW	(original)
+++ pkg/bidiv/branches/upstream/current/WHATSNEW	Sat Jan  7 21:02:22 2006
@@ -1,3 +1,12 @@
+Release 1.5: Jan 7, 2006
+  * Fixed buffer size error that caused buffer overflows (and crashes) in
+    certain cases. Thanks to Dan Kenigsberg and to Shachar Raindel for
+    reporting the bug and suggesting patches.
+  * Update bidiv(1) manual to reflect bidiv's UTF8 capabilities (that already
+    existed in release 1.4).
+  * Clarify GPL license in bidiv.c and README, and include GPL's "COPYING"
+    license file in the bidiv distribution.
+
 Release 1.4: Oct 21, 2002
   * Fix auto direction so that if the first line of a paragraph has no
     direction, the direction of the previous paragraph is used temporarily.

Modified: pkg/bidiv/branches/upstream/current/bidiv.1
==============================================================================
--- pkg/bidiv/branches/upstream/current/bidiv.1	(original)
+++ pkg/bidiv/branches/upstream/current/bidiv.1	Sat Jan  7 21:02:22 2006
@@ -1,6 +1,6 @@
 '\" t
 .\" Copyright (c) 2001, Nadav Har'El
-.TH bidiv 1 "19 Feb 2001" "Bidiv" "Ivrix"
+.TH bidiv 1 "7 Jan 2006" "Bidiv" "Ivrix"
 .SH NAME
 bidiv \- bidirectional text filter
 .SH SYNOPSIS
@@ -14,19 +14,24 @@
 .BI [\| file\|.\|.\|. \|]
 .SH DESCRIPTION
 .B bidiv
-is a filter, or viewer, for birectional text stored in logical-order, into
-visual-order 8-bit text which can be viewed on terminals that do not handle
+is a filter, or viewer, for birectional text stored in logical-order. It
+converts such text into
+visual-order text which can be viewed on terminals that do not handle
 bidirectionality. The output visual-order text is formatted
 assuming a fixed number of characters per line (automatically determined
 or given with the
 .B -w
 parameter).
 
-The current version is oriented towards Hebrew, and therefore reads
-ISO-8859-8-i (logical) encoded text and outputs ISO-8859-8 (visual) encoded
-text. However,
 .B bidiv
-can be easily adapted to other encodings and right-to-left languages.
+is oriented towards Hebrew, and assumes the input to be
+a Hebrew and ASCII text encoded in one of the two common logical-order
+encodings: ISO-8859-8-i or UTF-8. Actually, bidiv guesses the encoding of its
+input at a character by
+character basis, so the input might be a mix of ISO-8859-8-i and Hebrew UTF-8.
+.BR bidiv 's
+output is visual-order text, in either the ISO-8859-8
+or UTF-8 encoding, depending on your locale setting.
 
 .B bidiv
 reads each
@@ -104,8 +109,8 @@
 case is rare, but does happen under random line-splitting circumstances, or
 when the text is defining words of a foreign language.
 
-TODO: maybe add another option to choose direction based on _input_ line. Would
-that be useful at all? I doubt it.
+.\"TODO: maybe add another option to choose direction based on _input_ line. Would
+.\"that be useful at all? I doubt it.
 .TP
 .B \-j
 Do not justify:
@@ -113,8 +118,9 @@
 on the left when shorter than the required line width (see the
 .B \-w
 option). The
-.B \-j option tells
-\B bidiv
+.B \-j
+option tells
+.B bidiv
 not to preform this justifications, and leave short lines unpadded.
 .TP
 .BI \-w\  width
@@ -172,7 +178,7 @@
 .TP 3 
 3.
 set "bidiv" as a filter for your mail program (mutt, pine, etc.) for viewing
-mail with the ISO 8859-8-i character set.
+mail with the ISO 8859-8-i character set, and Hebrew UTF-8 mail.
 
 .SH ENVIRONMENT
 .B COLUMNS

Modified: pkg/bidiv/branches/upstream/current/bidiv.c
==============================================================================
--- pkg/bidiv/branches/upstream/current/bidiv.c	(original)
+++ pkg/bidiv/branches/upstream/current/bidiv.c	Sat Jan  7 21:02:22 2006
@@ -11,10 +11,10 @@
    TODO: This should be a general utility which is useful not only to Hebrew:
    it should work for Arabic and other RL languages too.
 
-   Copyright (c) 2001 Nadav Har'El
-   License: GNU General Public License
+   Copyright (c) 2001-2006 Nadav Har'El
+   License: GNU General Public License version 2
 
-   This is version 1.4. See WHATSNEW file for version history.
+   This is version 1.5. See WHATSNEW file for version history.
 */
 
 #include <stdio.h>
@@ -47,7 +47,7 @@
 void
 bidiv(FILE *fp)
 {
-	unsigned char *in, *out;
+	char *in, *out;
 	FriBidiChar *unicode_in, *unicode_out;
 	int len, i, c;
 	int rtl_line;
@@ -65,8 +65,13 @@
 	in=(char *)malloc(width+1);
 	out=(char *)malloc(width*7+1); /* 7 is the maximum number of
 					  bytes in one UTF8 char? */
-	unicode_in=(FriBidiChar *)malloc(sizeof(FriBidiChar)*width);
-	unicode_out=(FriBidiChar *)malloc(sizeof(FriBidiChar)*width);
+	/* We use (width+1) not just width, to leave place for a double-
+	   width null character, which we might or might not need to write
+	   (we don't add one to unicode_in, but it appears that fribidi_log2vis
+	   puts one (a single null byte?) in unicode_out). But it can't hurt
+	   to be extra safe and leave 2 extra bytes on both. */
+	unicode_in=(FriBidiChar *)malloc(sizeof(FriBidiChar)*(width+1));
+	unicode_out=(FriBidiChar *)malloc(sizeof(FriBidiChar)*(width+1));
 
 	c=0;
 	while(c!=EOF){
@@ -210,6 +215,11 @@
 				putchar(' ');
 		puts(out);
 	}
+	/* Free the memory we have allocated */
+	free(in);
+	free(out);
+	free(unicode_in);
+	free(unicode_out);
 }
 
 int



More information about the Debian-hebrew-package mailing list