Skip Menu |

This queue is for tickets about the Text-CSV_XS CPAN distribution.

Report information
The Basics
Id: 74330
Status: resolved
Priority: 0/
Queue: Text-CSV_XS

People
Owner: Nobody in particular
Requestors: bitcard [...] davel.me.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.50
Fixed in: 0.87



Subject: Text::CSV_XS can be made to produce bad strings
The attached test shows Text::CSV_XS producing a string which is not internally valid in Perl, and will cause Perl to explode internally. Text::CSV_PP handles this correctly. The error occurs if a string containing top-bit set characters stored in the byte representation inside Perl, is combined with a string stored in the utf8 representation. The test is also visible at https://gist.github.com/1671552 Kind regards, Dave Lambley
Subject: bad_string.pl
#!/usr/bin/env perl use strict; use warnings; use Text::CSV_XS; use Text::CSV_PP; use Test::More; foreach my $implementation ('Text::CSV_PP', 'Text::CSV_XS') { diag "Using $implementation"; my $csv = $implementation->new({ binary => 1 }); my $ax = chr(0xfa); my $bx = "foo"; # We set the UTF-8 flag on a string with no funny characters utf8::upgrade($bx); is($bx, "foo", "no funny characters in the string"); ok(utf8::valid($ax), "first string correct in Perl"); ok(utf8::valid($bx), "second string correct in Perl"); $csv->combine($ax, $bx) or die $csv->error_diag; my $foo = $csv->string(); ok(utf8::valid($foo), "is combined string correct inside Perl?"); is($foo, qq{\xfa,foo}, "expected result"); } done_testing();
Fixed. Will be in the next release. Fetch fro repo if you cannot wait $ git clone http://repo.or.cz/r/Text-CSV_XS.git Text-CSV-XS or $ wget --output-document=Text-CSV_XS-git.tgz \ 'http://repo.or.cz/w/Text-CSV_XS.git?a=snapshot;sf=tgz'