Skip Menu |

This queue is for tickets about the Chess-PGN-Parse CPAN distribution.

Report information
The Basics
Id: 111339
Status: open
Priority: 0/
Queue: Chess-PGN-Parse

People
Owner: Nobody in particular
Requestors: sgunderson [...] bigfoot.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Truncated PGN can permanently wedge the entire module
Date: Thu, 21 Jan 2016 00:17:42 +0100
To: bug-Chess-PGN-Parse [...] rt.cpan.org
From: "Steinar H. Gunderson" <sgunderson [...] bigfoot.com>
Hi, I noticed a problem with Chess::PGN::Parse in production; it turns out that if you ever give it a truncated PGN, the entire module can go into a state where it can no longer parse anything. This holds even if you create a new object, since %memory is local to the module, not the object. Example program to reproduce: === #! /usr/bin/perl use strict; use warnings; use Chess::PGN::Parse; my $pgn; $pgn = Chess::PGN::Parse->new(undef, "["); $pgn->read_game(); # At this point, the entire module is hosed. Try to e.g. parse a valid game: my $text = <<"EOF"; [Event "78th Tata Steel GpA"] [Site "Wijk aan Zee NED"] [Date "2016.01.16"] [White "Navara, David"] [Black "Carlsen, Magnus"] [Result "*"] 1. e4 * EOF $pgn = Chess::PGN::Parse->new(undef, $text); if ($pgn->read_game()) { print "Success\n"; } else { print "Failure\n"; } === The same bug seems to make it impossible to have two different PGN objects being read at the same time (e.g. if you want to diff two PGN files). I've attached a patch, with test. /* Steinar */ -- Homepage: https://www.sesse.net/

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #111339] Truncated PGN can permanently wedge the entire module
Date: Sat, 23 Jan 2016 10:54:50 +0100
To: bug-Chess-PGN-Parse [...] rt.cpan.org
From: Giuseppe Maxia <gmax [...] cpan.org>
Thanks for your contribution! I have merged and released Chess::PGN::Parse 0.20 On Thu, Jan 21, 2016 at 12:17 AM, Steinar H. Gunderson via RT < bug-Chess-PGN-Parse@rt.cpan.org> wrote: Show quoted text
> Wed Jan 20 18:17:58 2016: Request 111339 was acted upon. > Transaction: Ticket created by sgunderson@bigfoot.com > Queue: Chess-PGN-Parse > Subject: Truncated PGN can permanently wedge the entire module > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: sgunderson@bigfoot.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=111339 > > > > Hi, > > I noticed a problem with Chess::PGN::Parse in production; it turns out that > if you ever give it a truncated PGN, the entire module can go into a state > where it can no longer parse anything. This holds even if you create a new > object, since %memory is local to the module, not the object. > > Example program to reproduce: > > === > #! /usr/bin/perl > use strict; > use warnings; > use Chess::PGN::Parse; > > my $pgn; > > $pgn = Chess::PGN::Parse->new(undef, "["); > $pgn->read_game(); > > # At this point, the entire module is hosed. Try to e.g. parse a valid > game: > > my $text = <<"EOF"; > [Event "78th Tata Steel GpA"] > [Site "Wijk aan Zee NED"] > [Date "2016.01.16"] > [White "Navara, David"] > [Black "Carlsen, Magnus"] > [Result "*"] > > 1. e4 * > EOF > > $pgn = Chess::PGN::Parse->new(undef, $text); > if ($pgn->read_game()) { > print "Success\n"; > } else { > print "Failure\n"; > } > === > > The same bug seems to make it impossible to have two different PGN objects > being read at the same time (e.g. if you want to diff two PGN files). > > I've attached a patch, with test. > > /* Steinar */ > -- > Homepage: https://www.sesse.net/ > >