Article View: gnu.emacs.vm.bug
Article #480Re: buglet (?) in qp-decode.c
From: Ralf Fassel
Date: Tue, 01 Jul 2008 08:13
Date: Tue, 01 Jul 2008 08:13
68 lines
3417 bytes
3417 bytes
* blueman <NOSPAM@nospam.com>
| > *** src/qp-decode.c~ Wed Feb 20 22:11:51 2008
| > --- src/qp-decode.c Mon Jun 30 12:03:41 2008
| > ***************
| > *** 88,93 ****
| > --- 88,94 ----
| > for (stop++; *stop && (*stop == ' ' || *stop == '\t'); stop++)
| > ;
| > } else {
| > + if (feof(stdin)) exit(0);
| > fprintf(stderr, "Error: line %d: '%c' is something other than line break or hex digit after = in quoted-printable encoding\n", lineno, *stop);
| > putchar('=');
| > putchar(*stop);
|
| I think I had noticed and reported a similar issue about 18 months
| ago. Robert also submitted a patch which I thought was now part of the
| standard VM distribution (but maybe not).
I think that your patch was about *not* exit(1)ing when this error
occurs due to an actual encoding error in the buffer (there actually
is another char at *stop). In my case the char at *stop is the
terminating '\0' character which was placed in the buffer by fgets().
At least the exit(1) in this part of the code (see below, marked (2))
is commented out in the latest VM release, where it was still active
in prior versions (I still use 7.19).
Not exiting here on EOF is a definite bug, since there is nothing more
to read in the buffer, but the code continues anyway (stop++).
Maybe the char which 'stop' is pointing at should be considered here,
and if it is '\0', then the end of the fgets-buffer has been reached.
There shouldn't be any binary content in the buffer, so '\0' cannot
occur there except when added by fgets as terminating character.
The code branch in question is (abbreviated):
} else { /* *stop == '=' */
stop++;
if ((d1 = strchr(hexdigits, *(stop))) &&
(d2 = strchr(hexdigits, *(stop+1)))) {
...
} else if ((d1 = strchr(hexdigits2, *(stop))) &&
(d2 = strchr(hexdigits2, *(stop+1)))) {
...
} else if (*stop == '\n') {
...
} else if (*stop == '\r') {
...
} else if (*stop == ' ' || *stop == '\t') {
...
} else {
(1)
fprintf(stderr, "Error: line %d: '%c' is something other than line break or hex digit after = in quoted-printable encoding\n", lineno, *stop);
putchar('=');
putchar(*stop);
stop++;
(2) /* exit(1); */
}
start = stop;
goto keep_processing;
}
Maybe at (1) another check for
else if (*stop == '\0')
needs to be added instead or in addition of the feof() check.
R'
Technical Details
Message-ID:
<yga4p7ahvjc.fsf@gepard2.akutech-local.de>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailReferences:
<ygalk0ni65f.fsf@gepard2.akutech-local.de> <m2skuulbe4.fsf@consult.pretender>Show Full Headers
Complete Article Headers
X-Google-Thread: f6829,141bbfda3d9204c6 X-Google-Attributes: gidf6829,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ralf Fassel <ralfixx@gmx.de> Newsgroups: gnu.emacs.vm.bug Subject: Re: buglet (?) in qp-decode.c Date: Tue, 01 Jul 2008 10:13:11 +0200 Lines: 68 Message-ID: <yga4p7ahvjc.fsf@gepard2.akutech-local.de> References: <ygalk0ni65f.fsf@gepard2.akutech-local.de> <m2skuulbe4.fsf@consult.pretender> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net MKGk21PvuAbx54Va5hxrDQ59BYjfUqtyNY3iKOTb0BMOlUoG0= Cancel-Lock: sha1:KrWXbqgThCbQlqUA2+hzP/w/Q9c= sha1:3o96l5d5iSEWemBnCyUkF4dvzLw= User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (linux)