Skip Menu |

This queue is for tickets about the OLE-Storage_Lite CPAN distribution.

Report information
The Basics
Id: 49479
Status: open
Priority: 0/
Queue: OLE-Storage_Lite

People
Owner: Nobody in particular
Requestors: jordan.hrycaj [...] 7safe.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.18
Fixed in: 0.18



The method OLEDate2Local() converts a windows Filetime time into a posix date array (struct tm-like). It may be called with a date argument 0 which is an unset windows file time. Now, the method OLEDate2Local() internally converts a 0 file time into a now meaningless negative posix time_t-like value. Going on using this value on on windows, by chance this always results in an undef return value as gmtime() rejects this value. At least on my Linux system, this time_t-like value is accepted and the result is NOT undef. This leads to errors in subsequent modules. Here is a fix: --- /usr/share/perl5/OLE/Storage_Lite.bak 2009-09-04 12:08:30.000000000 +0100 +++ /usr/share/perl5/OLE/Storage_Lite.pm 2009-09-04 17:11:52.000000000 +0100 @@ -1328,6 +1328,9 @@ # Unpack the FILETIME into high and low longs. my ( $lo, $hi ) = unpack 'V2', $oletime; + # No date defined + return undef unless $lo && $hi ; + # Convert the longs to a double. my $nanoseconds = $hi * 2**32 + $lo; Kind regards Jordan
On Mon Sep 07 05:49:44 2009, JordanHrycaj wrote: Show quoted text
> The method OLEDate2Local() converts a windows Filetime time into > a posix date array (struct tm-like). It may be called with a > date argument 0 which is an unset windows file time.
Hi Jordon, Thanks for that. Can you check if the patch passes the existing testcase or suggest an alternative test if it doesn't. http://cpansearch.perl.org/src/JMCNAMARA/OLE-Storage_Lite-0.18/t/01_date_conversion.t John. --
Subject: RE: [rt.cpan.org #49479] OLEDate2Local() bug with 0 datetime
Date: Mon, 7 Sep 2009 11:58:09 +0100
To: <bug-OLE-Storage_Lite [...] rt.cpan.org>
From: "Jordan Hrycaj" <Jordan.Hrycaj [...] 7safe.com>
Hi John Here is a test log: ---- x ---- x ----- jordan@Breakfast:~/Desktop/Devel/msg2mht/OLE-Storage_Lite-0.18$ cp /usr/share/perl5/OLE/Storage_Lite.pm lib/OLE/Storage_Lite.pm jordan@Breakfast:~/Desktop/Devel/msg2mht/OLE-Storage_Lite-0.18$ l total 32 -rw-r--r-- 1 jordan jordan 3563 2008-12-31 13:10 Changes drwxr-xr-x 3 jordan jordan 4096 2008-12-31 13:11 lib -rw-r--r-- 1 jordan jordan 428 2008-12-31 13:07 Makefile.PL -rw-r--r-- 1 jordan jordan 334 2008-12-31 13:07 MANIFEST -rw-r--r-- 1 jordan jordan 412 2008-12-31 13:11 META.yml -rw-r--r-- 1 jordan jordan 955 2008-12-31 13:07 README drwxr-xr-x 2 jordan jordan 4096 2008-12-31 13:11 sample drwxr-xr-x 2 jordan jordan 4096 2008-12-31 13:11 t jordan@Breakfast:~/Desktop/Devel/msg2mht/OLE-Storage_Lite-0.18$ perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for OLE::Storage_Lite jordan@Breakfast:~/Desktop/Devel/msg2mht/OLE-Storage_Lite-0.18$ make cp lib/OLE/Storage_Lite.pm blib/lib/OLE/Storage_Lite.pm Manifying blib/man3/OLE::Storage_Lite.3pm jordan@Breakfast:~/Desktop/Devel/msg2mht/OLE-Storage_Lite-0.18$ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00_load...............ok t/01_date_conversion....ok All tests successful. Files=2, Tests=199, 0 wallclock secs ( 0.19 cusr + 0.00 csys = 0.19 CPU) jordan@Breakfast:~/Desktop/Devel/msg2mht/OLE-Storage_Lite-0.18$ ---- x ---- x ----- Kind regards Jordan Show quoted text
-----Original Message----- From: John McNamara via RT [mailto:bug-OLE-Storage_Lite@rt.cpan.org] Sent: 07 September 2009 11:48 To: Jordan Hrycaj Subject: [rt.cpan.org #49479] OLEDate2Local() bug with 0 datetime <URL: https://rt.cpan.org/Ticket/Display.html?id=49479 > On Mon Sep 07 05:49:44 2009, JordanHrycaj wrote:
> The method OLEDate2Local() converts a windows Filetime time into > a posix date array (struct tm-like). It may be called with a > date argument 0 which is an unset windows file time.
Hi Jordon, Thanks for that. Can you check if the patch passes the existing testcase or suggest an alternative test if it doesn't. http://cpansearch.perl.org/src/JMCNAMARA/OLE-Storage_Lite-0.18/t/01_date_conversion.t John. -- This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
On Mon Sep 07 06:58:44 2009, JordanHrycaj wrote: Show quoted text
> Hi John > > Here is a test log:
Hi Jordon, Great. Thanks. One last thing. Could you send a small code example that demonstrates the bug. I'll use to create a test case. John. --
Subject: RE: [rt.cpan.org #49479] OLEDate2Local() bug with 0 datetime
Date: Mon, 7 Sep 2009 13:30:17 +0100
To: <bug-OLE-Storage_Lite [...] rt.cpan.org>
From: "Jordan Hrycaj" <Jordan.Hrycaj [...] 7safe.com>
Hi John I hope that will do. --- OLE-Storage_Lite-0.18.orig/t/01_date_conversion.t 2008-12-31 13:07:04.000000000 +0000 +++ OLE-Storage_Lite-0.18/t/01_date_conversion.t 2009-09-07 13:26:59.000000000 +0100 @@ -9,10 +9,17 @@ use strict; use OLE::Storage_Lite; -use Test::More tests => 198; +use Test::More tests => 199; my @testdata; +# At the root level, we need to handle 0x0000000000000000, see the invocations of +# OLEDate2Local() in method _getNthPps() at Storage_Lite.pm(lines 1139 and 1142). +# Note that this test has different outcomes on Windows and Linux depending on +# gmtime(-1) = undef/Windows or (59 59 23 31 11 69 3 364 0)/Linux. +my $undef_result = OLE::Storage_Lite::OLEDate2Local "\c@"x8; +is($undef_result, undef, " \tLocalDate2OLE: 0 -> undef"); + # Read the test data from the end of the file... while (<DATA>) { next unless /\S/; Jordan Show quoted text
-----Original Message----- From: John McNamara via RT [mailto:bug-OLE-Storage_Lite@rt.cpan.org] Sent: 07 September 2009 12:02 To: Jordan Hrycaj Subject: [rt.cpan.org #49479] OLEDate2Local() bug with 0 datetime <URL: https://rt.cpan.org/Ticket/Display.html?id=49479 > On Mon Sep 07 06:58:44 2009, JordanHrycaj wrote:
> Hi John > > Here is a test log:
Hi Jordon, Great. Thanks. One last thing. Could you send a small code example that demonstrates the bug. I'll use to create a test case. John. -- This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
On Mon Sep 07 08:30:44 2009, JordanHrycaj wrote: Show quoted text
> Hi John > > I hope that will do.
Hi Jordon, An example program would help me more. Also, an example OLE file (Word or Excel or anything else) that will trigger the bug would be useful, if you have one. John. --
Subject: RE: [rt.cpan.org #49479] OLEDate2Local() bug with 0 datetime
Date: Mon, 7 Sep 2009 16:31:33 +0100
To: <bug-OLE-Storage_Lite [...] rt.cpan.org>
From: "Jordan Hrycaj" <Jordan.Hrycaj [...] 7safe.com>
Hello John Unfortunately I cannot send you examples as I deal with private .msg data (and do not have the time to forge a file without a date on the root directory/object). Simply using Outlook and storing a .msg file will not produce such a file (maybe older or foreign Outlook versions will do). But regardless of an example, the fact that method _getNthPps() at Storage_Lite.pm(lines 1139 and 1142) assumes that there is ALWAYS a date on the root object should ring alarm bells unless this assumption is verified :). Sorry that I cannot help here Jordan Show quoted text
-----Original Message----- From: John McNamara via RT [mailto:bug-OLE-Storage_Lite@rt.cpan.org] Sent: 07 September 2009 15:30 To: Jordan Hrycaj Subject: [rt.cpan.org #49479] OLEDate2Local() bug with 0 datetime <URL: https://rt.cpan.org/Ticket/Display.html?id=49479 > On Mon Sep 07 08:30:44 2009, JordanHrycaj wrote:
> Hi John > > I hope that will do.
Hi Jordon, An example program would help me more. Also, an example OLE file (Word or Excel or anything else) that will trigger the bug would be useful, if you have one. John. -- This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
On Mon Sep 07 11:31:59 2009, JordanHrycaj wrote: Show quoted text
> Hello John > > Unfortunately I cannot send you examples as I deal with > private .msg data
Hi Jordan, No problem, that is understandable. I should be able to re-create an example file based on your description. Thanks, John. --