delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/11/16/04:45:44

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:content-type
:content-transfer-encoding:from:subject:to:message-id; q=dns; s=
default; b=vfomA7VrPFuppiM7tEZlB2DuFyNqe6nHgn4YrM5q/9VmCCWZRXAi2
Gs36VOiGHx7aqWLLeXSRLhL0J8qtGUHNGoH2PZNAnjrR3ByoZWLUAsPLzQ6cOxpb
CjJPZA6s/ESZybd8ONBO8OWvb1w+7mkD9GU/Dqjfjv2qIykH0iSaPg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:content-type
:content-transfer-encoding:from:subject:to:message-id; s=
default; bh=29fjq69K5xQ9Rmmp2T7qOBTV0/E=; b=wzGfU+YCPk+FpX2h41ju
TFUge+ZlMKRUF69xNc1vL55/kWLjU69uhHFRyttyDYhk0C9xQsfh+/Q/gWNpTiVI
mUhJ8BtDwzw64E7eGGcwgwQETLFu1Wduvcta2kQPzMpV3c6BoRZVVC3AovBBA4qc
tOPS4cIoUYHqC88j1BT+v1M=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Dynamic, Possible, H*F:U*ln, site
X-HELO: mx.erasmas.ch
Mime-Version: 1.0
Date: Thu, 16 Nov 2017 09:45:14 +0000
From: "Lando Nachtmann" <ln AT h0x DOT de>
Subject: Perl: Cygwin::win_to_posix_path() fails; Possible memory corruption
To: cygwin AT cygwin DOT com
Message-Id: <20171116094514.99DDB1020D6@mx.erasmas.ch>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id vAG9jg1Q014252

Hello,

I have a problem using the Perl-integrated Cygwin path conversion methods. 
Below is my Perl bug report (#132443) created via perlbug for details. They suggested to file a bug against the XML::DOM module. But since it is a Cygwin-specific problem, I thought it is better to ask on the mailing list first.

Thanks,
Lando

This is a bug report for perl from ln AT h0x DOT de,
generated with the help of perlbug 1.40 running under perl 5.26.1.

The Perl-integrated conversion function for Cygwin paths Cygwin::win_to_posix_path() is broken.
Tested with a path read from a XML file using XML::DOM, its output is faulty.
Depending on the setting, its output is empty, garbage or aborts with 'Out of memory'.
Most likely, there are some memory allocation issues.

To reproduce, please call script 'test.pl' with attached XML file 'test.xml' as argument.
Depending on used path to file (relative or absolute, Windows or POSIX style etc.), different types of failure appear.

+++ test.pl +++
#!/usr/bin/env perl

use XML::DOM;

print 'XML FILE (argument):>' . $ARGV[0] . "<\n";
my $xml_path = Cygwin::win_to_posix_path($ARGV[0]);
print 'XML FILE (converted):>' . $xml_path . "<\n";

my $parser = new XML::DOM::Parser();
my $dom_tree = $parser->parsefile($xml_path);
my $attr_path = $dom_tree->getDocumentElement()->getAttribute('attr');
print 'PATH FROM ATTRIBUTE:>' . $attr_path . "<\n";

my $win_attr_path = Cygwin::win_to_posix_path($attr_path);
print 'PATH FROM ATTRIBUTE (converted):>' . $win_attr_path . "<\n";

+++ test.xml +++
<?xml version="1.0" ?>
<Test attr="C:\Cygwin\usr\bin\ls.exe"></Test>

Please note that in my tests, only the path read from the XML is affected. Direct output of this
file before (broken) conversion shows no abnormality though. Therefore I am not sure if this bug
originates in Perl core or XML::DOM module.---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.26.1:

Configured by ASSI at Tue Sep 26 18:57:14 CEST 2017.

Summary of my perl5 (revision 5 version 26 subversion 1) configuration:

Platform:
osname=cygwin
osvers=2.9.0(0.31853)
archname=i686-cygwin-threads-64int-multi
uname='cygwin_nt-6.3-wow cygwin 2.9.0(0.31853) 2017-09-12 10:41 i686 cygwin '
config_args='-des -Dprefix=/usr -Dmksymlinks -Darchname=i686-cygwin-threads-64int
-Dlibperl=cygperl5_26.dll -Dcc=gcc -Dld=g++ -Accflags=-ggdb -O2 -pipe
-Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1 -fwrapv'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=undef
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler:
cc='gcc'
ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2 -pipe
-Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1 -fwrapv
-fno-strict-aliasing -fstack-protector-strong -D_FORTIFY_SOURCE=2'
optimize='-O3'
cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2 -pipe
-Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1 -fwrapv
-fno-strict-aliasing -fstack-protector-strong'
ccversion=''
gccversion='6.4.0'
gccosandvers=''
intsize=4
longsize=4
ptrsize=4
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=12
longdblkind=3
ivtype='long long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='g++'
ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base
-fstack-protector-strong'
libpth=/usr/lib
libs=-lpthread -lgdbm -ldb -ldl -lcrypt -lgdbm_compat
perllibs=-lpthread -ldl -lcrypt
libc=/usr/lib/libcygwin.a
so=dll
useshrplib=true
libperl=cygperl5_26.dll
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=dll
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags=' --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base
-fstack-protector-strong'

Locally applied patches:
Cygwin: README
Cygwin: use auto-image-base instead of fixed DLL base address
Cygwin: modify hints
Cygwin: Configure correct libsearch
Cygwin: Configure correct libpth
Cygwin: Win32 correct UTF8 handling
Perl: File-Path-2.14 (fixes CVE2017-6512)

---
@INC for perl 5.26.1:
/usr/local/lib/perl5/site_perl/5.26/i686-cygwin-threads-64int
/usr/local/share/perl5/site_perl/5.26
/usr/lib/perl5/vendor_perl/5.26/i686-cygwin-threads-64int
/usr/share/perl5/vendor_perl/5.26
/usr/lib/perl5/5.26/i686-cygwin-threads-64int
/usr/share/perl5/5.26

---
Environment for perl 5.26.1:
HOME=/home/ln
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/bin:/usr/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Windows/system
2:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShe
l/v1.0:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/TortoiseGit/bin
PERL_BADLANG (unset)
SHELL=/bin/bash

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019