Article View: news.software.nntp
Article #79241Re: Cleanfeed Binary Checks
From: Julien ÉLIE
Date: Thu, 31 Jul 2008 06:15
Date: Thu, 31 Jul 2008 06:15
77 lines
4019 bytes
4019 bytes
Hi Marco,
> It's a well known INN bug, which has been around for more than 5 years
> now.
> The $hdr{__BODY__} scalar, which is magic, is not created correctly by
> innd and regexps matching new lines fail.
Seeing innd/perl.c:
http://inn.eyrie.org/viewcvs/trunk/innd/perl.c?view=markup
/* Create %hdr and stash a copy of every known header. Path has to be
handled separately since it's been munged by article processing. */
hdr = perl_get_hv("hdr", 1);
for (i = 0 ; i < MAX_ARTHEADER ; i++) {
if (HDR_FOUND(i)) {
hp = &ARTheaders[i];
hv_store(hdr, (char *) hp->Name, hp->Size, newSVpv(HDR(i), 0), 0);
}
}
/* Store the article body. We don't want to make another copy of it,
since it could potentially be quite large. Instead, stash the
pointer in the static SV * body. We set LEN to 0 and inc the
refcount to tell Perl not to free it (either one should be enough).
Requires 5.004. In testing, this produced a 17% speed improvement
over making a copy of the article body for a fairly heavy filter. */
if (artBody) {
if (!body) {
body = newSV(0);
(void) SvUPGRADE(body, SVt_PV);
}
SvPVX(body) = artBody;
SvCUR_set(body, artLen);
SvLEN_set(body, 0);
SvPOK_on(body);
(void) SvREADONLY_on(body);
(void) SvREFCNT_inc(body);
hv_store(hdr, "__BODY__", 8, body, 0);
}
hv_store(hdr, "__LINES__", 9, newSViv(lines), 0);
ENTER;
SAVETMPS;
PUSHMARK(SP);
rc = perl_call_sv((SV *) filter, G_EVAL|G_SCALAR|G_NOARGS);
SPAGAIN;
hv_undef(hdr);
I do not understand well
SvPVX(body) = artBody;
because normally, SvPVX returns a pointer to the physical string in the SV:
char* SvPVX(SV* sv)
whereas it looks as though it was set here.
As for hv_store, "the return value will be NULL if the operation failed or
if the value did not need to be actually stored within the hash (as in the case
of tied hashes). Otherwise it can be dereferenced to get the original SV*.
Note that the caller is responsible for suitably incrementing the reference
count of val before the call, and decrementing it if the function returned NULL."
Decrementing is not taken into account here.
Source : http://perldoc.perl.org/perlapi.html
--
Julien ÉLIE
« Ambo florentes aetatibus, Arcades ambo » (Virgile, _Églogue VII_)
Technical Details
Message-ID:
<g6rlb6$cmh$1@news.trigofacile.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!border-2.ams.xsnews.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!217.145.39.3.MISMATCH!talisker.lacave.net!lacave.net!news.trigofacile.com!not-for-mailReferences:
<g61rme$nqb$1@news.mixmin.net> <g62e1h$ejc$1@news.trigofacile.com> <g6qtgm$sq3$1@bongo.bofh.it>Show Full Headers
Complete Article Headers
Message-ID: <g6rlb6$cmh$1@news.trigofacile.com> Subject: Re: Cleanfeed Binary Checks Date: Thu, 31 Jul 2008 08:15:56 +0200 From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> References: <g61rme$nqb$1@news.mixmin.net> <g62e1h$ejc$1@news.trigofacile.com> <g6qtgm$sq3$1@bongo.bofh.it> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!border-2.ams.xsnews.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!217.145.39.3.MISMATCH!talisker.lacave.net!lacave.net!news.trigofacile.com!not-for-mail Newsgroups: news.software.nntp Organization: TrigoFACILE -- http://www.trigofacile.com/ Lines: 77 NNTP-Posting-Host: aaubervilliers-151-1-57-111.w83-112.abo.wanadoo.fr Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 8bit X-Trace: news.trigofacile.com 1217484966 13009 83.112.30.111 (31 Jul 2008 X-Complaints-To: abuse@trigofacile.com NNTP-Posting-Date: Thu, 31 Jul 2008 06:16:06 +0000 (UTC) In-Reply-To: <g6qtgm$sq3$1@bongo.bofh.it> X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18000