Re: tin 1.8.1 20060215: Segfault

Michael Bienia <[email protected]>
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
On 2006-02-20 03:20:09 +0100, Urs Janßen wrote:
> anyone else willing to look at this?

I've found the bug.

The problem is in convert_tex2iso. In an UTF-8 environment
convert_tex2iso writes more data into *to as there is space:
it replaces for example "a (2 bytes) with ä (in UTF-8 2 bytes) and a
space at the end of the word, in total 3 bytes.
I could reproduce the crash with a line containing lot of tex chars:
| t"ast "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U "a "o "u "A "O "U

@Peter: Can you confirm that the attached patch fixes your problem?

Michael
patch-20060221.diff (text/plain, 419 B)
--- tin-1.8.1/src/charset.c	2005-12-02 12:07:35.000000000 +0100
+++ tin-1.8.1.working/src/charset.c	2006-02-21 20:27:20.621057949 +0100
@@ -309,7 +309,7 @@ convert_tex2iso(
 			subst_len = strlen(tex_from[i]);
 			if (!strncmp(from + col, tex_from[i], subst_len)) {
 				strcat(to, tex_to[i]);
-				spaces += subst_len - 1;
+				spaces += subst_len - strlen(tex_to[i]);
 				col += subst_len - 1;
 				ex = TRUE;
 			}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.