develooper Front page | perl.perl5.porters | Postings from July 2008

[perl #56834] No test coverage for the DO_UTF8() branch of case FF_CHECKCHOP in pp_formline

From:
Nicholas Clark
Date:
July 11, 2008 11:30
Subject:
[perl #56834] No test coverage for the DO_UTF8() branch of case FF_CHECKCHOP in pp_formline
Message ID:
rt-3.6.HEAD-8814-1215785583-1361.56834-75-0@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #56834]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56834 >



This is a bug report for perl from nick@ccl4.org,
generated with the help of perlbug 1.39 running under perl 5.11.0.


-----------------------------------------------------------------
[Please describe your issue here]

There's no test coverage of any part of the DO_UTF8 branch of the FF_CHECKCHOP
case of pp_formline. Specifically, based on code inspection, I think that

			if (itemsize <= fieldsize) {
			    const char *send = chophere = s + itemsize;
			    while (s < send) {
				if (*s == '\r') {
				    itemsize = s - item;
				    chophere = s;
				    break;
				}
				if (*s++ & ~31)
				    gotsome = TRUE;
			    }
			}

is wrong - chophere should be s + len (or some value in octects, not
characters). I think that this bug should manifest as an inability to find a
\r if the string is long enough with sufficient characters that encode as
multiple bytes of UTF-8.


Also, I think that the subsequent

			    sv_pos_u2b(sv, &itembytes, 0);

is needlessly inefficient. I think that the return value of itembytes is just
len as determined earlier by

		const char *s = item = SvPV_const(sv, len);

But I am not comfortable making this change without regression tests first.

Nicholas Clark

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.11.0:

Configured by nick at Mon Jun 30 09:41:19 BST 2008.

Summary of my perl5 (revision 5 version 11 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.6.16.29-xenu, archname=x86_64-linux
    uname='linux zazen 2.6.16.29-xenu #1 smp tue jan 9 00:53:46 gmt 2007 x86_64 gnulinux '
    config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list=  -Dinc_version_list_init=0 -Doptimize=-g -Uusethreads=n -Uuse64bitint -Dusemymalloc -Duseperlio -Accflags=-DPERL_TRACK_MEMPOOL -Dprefix=~/Sandpit/snap5.11.x-34094 -Dinstallman1dir=none -Dinstallman3dir=none -de'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
  Compiler:
    cc='ccache gcc', ccflags ='-DPERL_TRACK_MEMPOOL -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-DPERL_TRACK_MEMPOOL -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20061115 (prerelease) (Debian 4.1.1-21)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.6.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.6'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib -fstack-protector'

Locally applied patches:
    DEVEL

---
@INC for perl 5.11.0:
    lib
    /home/nick/Sandpit/snap5.11.x-34094/lib/perl5/5.11.0/x86_64-linux
    /home/nick/Sandpit/snap5.11.x-34094/lib/perl5/5.11.0
    /home/nick/Sandpit/snap5.11.x-34094/lib/perl5/site_perl/5.11.0/x86_64-linux
    /home/nick/Sandpit/snap5.11.x-34094/lib/perl5/site_perl/5.11.0
    .

---
Environment for perl 5.11.0:
    HOME=/home/nick
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/nick/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About