Skip Menu |
 

This queue is for tickets about the Perl-Dist-Strawberry CPAN distribution.

Report information
The Basics
Id: 59862
Status: resolved
Priority: 0/
Queue: Perl-Dist-Strawberry

People
Owner: Nobody in particular
Requestors: bill.spernow [...] securitymentors.com
Cc:
AdminCc:

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



Subject: Default state of Binmode is NOT binary pass thru
Download (untitled) / with headers
text/plain 648b
Dist: Strawberry v5.12.0.1 Platform: Win 7 Ultimate 64 bit and XP Pro 64 bit Put the attached files into a folder named C:\Perl_Binmode_BUG_Docs When executed the script will calculate the MD5 hash value of the included two TEXT files. These two TEXT files are different in that one has 0D/0A end-of-line values throughout the file, while the other ONLY has OA values. The problem I've discovered is that PERL calculates the EXACT SAME hash value for both files!!! It appears that BINMODE in its default state is filtering OD hex values out of the data stream such that they are NEVER passed on to the MD5 digest function. Please advise...
Subject: Perl_Binmode_BUG_Example.pl
use bytes; my $Count = 0; my $PathPlusFilenameFound = ''; my $FileNameFound = ''; my $PathToFilenameFound = ''; my $HashValueCalculated = 0; my $md5; my $Record; my $PassCount = 0; my $ASCII_Value; use File::Find; use Digest::MD5; use File::Basename; open (DUMP, '>C:/Perl_BUG_Docs/Dump-File.txt'); @ARGV = qw(C:/Perl_BUG_Docs/) unless @ARGV; sub GetAllNames { $Count++; $PathPlusFilenameFound = $File::Find::name, -d && "/", "\n"; print "1-Starting hash of $PathPlusFilenameFound\n"; if ($Count > 1) { $FileNameFound = basename($PathPlusFilenameFound); $PathToFileNameFound = dirname($PathPlusFilenameFound); print "2-Changing DIR to $PathToFileNameFound\n"; chdir ($PathToFileNameFound); open(SourceFile, "<$FileNameFound") or die "Can't open SourceFile: $!"; print "Just opened: $FileNameFound\n"; $PassCount = 0; $Record = ''; binmode(Source_File); $md5 = Digest::MD5->new; while (read(SourceFile, $Record, 1)) { $LenGot = length($Record); $md5->add($Record); $ASCII_Value = ord($Record); $PassCount++; print DUMP "$FileNameFound Count: $PassCount Length: $LenGot Data: $Record $ASCII_Value\n"; } $HashValueCalculated = $md5->hexdigest; close(SourceFile) or die "Can't close SourceFile: $!"; print "RESULTS: $PassCount $HashValueCalculated $FileNameFound\n\n"; } } find (\&GetAllNames, @ARGV); print "Total Count is $Count\n"; close (DUMP);
Subject: Example_Text_With-0Ds-0As.txt
Outside In® Viewer Technology © 1991, 2007, 2008, 2009 Oracle. v8.3.2 for Windows 2000, XP, 2003 Server, Vista, 2008 Server Updated Oct 1, 2009 This viewer component works with X-Ways Forensics/WinHex 12.1 and later, if operated with a forensic license issued for v12.05 and later. 1) If you already have a file named msvcr80.dll in your Windows system under C:\Windows\WinSxS\x86_Microsoft.VC80.CRT_*, you can omit this step. Otherwise first please install the appropriate Microsoft Visual C++ 2005 SP1 Redistributable Package for your Windows environment. http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&DisplayLang=en 2) Extract all the viewer component files to a folder of your choice and point X-Ways Forensics to this folder in the Options | Viewer Programs dialog window, by clicking the "..." button in the "Use separate viewer component" section. By default, X-Ways Forensics expects the viewer component files in a subfolder \viewer of its own installation path. 3) Enable [x] Use separate viewer component. The viewer component will now be used for the preview mode and for the full window view (when double-clicking files in the directory browser). It also enables finding in text PDF documents and more. -- Zuletzt aktualisiert am 1. Okt. 2009. Diese Viewer-Komponente funktioniert mit X-Ways Forensics/WinHex 12.1 und neuer, wenn betrieben mit einer forensischen Lizenz, die auf v12.05 oder neuer ausgestellt ist. 1) Wenn Sie bereits eine Datei namens msvcr80.dll in Ihrem Windows-System unter C:\Windows\WinSxS\x86_Microsoft.VC80.CRT_* haben, können Sie diesen Schritt überspringen. Andernfalls installieren Sie bitte erst das korrekte Microsoft Visual C++ 2005 SP1 Redistributable Package für Ihr Windows. http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&DisplayLang=de 2) Extrahieren Sie alle Dateien der Viewer-Komponente in einen Ordner Ihrer Wahl und verweisen Sie X-Ways Forensics auf diesen Ordner im Dialogfenster Optionen | Viewer-Programme, indem Sie auf den Schalter "..." hinter "Separate Viewer-Komponente verwenden" klicken. Standardmäßig erwartet X-Ways Forensics die Viewer-Komponente im Ordner \viewer unterhalb des Installationspfads. 3) Schalten Sie [x] "Separate Viewer-Komponente verwenden" ein. Die Viewer-Komponente wird fortan für den Vorschau-Modus und die volle Fensteransicht (nach Doppelklick auf Dateien im Verzeichnis-Browser) verwendet. Sie erlaubt auch das Finden von Text in PDF-Dokumenten u. a.
Subject: Example_Text_Without-0Ds.txt
Outside In® Viewer Technology © 1991, 2007, 2008, 2009 Oracle. v8.3.2 for Windows 2000, XP, 2003 Server, Vista, 2008 Server Updated Oct 1, 2009 This viewer component works with X-Ways Forensics/WinHex 12.1 and later, if operated with a forensic license issued for v12.05 and later. 1) If you already have a file named msvcr80.dll in your Windows system under C:\Windows\WinSxS\x86_Microsoft.VC80.CRT_*, you can omit this step. Otherwise first please install the appropriate Microsoft Visual C++ 2005 SP1 Redistributable Package for your Windows environment. http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&DisplayLang=en 2) Extract all the viewer component files to a folder of your choice and point X-Ways Forensics to this folder in the Options | Viewer Programs dialog window, by clicking the "..." button in the "Use separate viewer component" section. By default, X-Ways Forensics expects the viewer component files in a subfolder \viewer of its own installation path. 3) Enable [x] Use separate viewer component. The viewer component will now be used for the preview mode and for the full window view (when double-clicking files in the directory browser). It also enables finding in text PDF documents and more. -- Zuletzt aktualisiert am 1. Okt. 2009. Diese Viewer-Komponente funktioniert mit X-Ways Forensics/WinHex 12.1 und neuer, wenn betrieben mit einer forensischen Lizenz, die auf v12.05 oder neuer ausgestellt ist. 1) Wenn Sie bereits eine Datei namens msvcr80.dll in Ihrem Windows-System unter C:\Windows\WinSxS\x86_Microsoft.VC80.CRT_* haben, können Sie diesen Schritt überspringen. Andernfalls installieren Sie bitte erst das korrekte Microsoft Visual C++ 2005 SP1 Redistributable Package für Ihr Windows. http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&DisplayLang=de 2) Extrahieren Sie alle Dateien der Viewer-Komponente in einen Ordner Ihrer Wahl und verweisen Sie X-Ways Forensics auf diesen Ordner im Dialogfenster Optionen | Viewer-Programme, indem Sie auf den Schalter "..." hinter "Separate Viewer-Komponente verwenden" klicken. Standardmäßig erwartet X-Ways Forensics die Viewer-Komponente im Ordner \viewer unterhalb des Installationspfads. 3) Schalten Sie [x] "Separate Viewer-Komponente verwenden" ein. Die Viewer-Komponente wird fortan für den Vorschau-Modus und die volle Fensteransicht (nach Doppelklick auf Dateien im Verzeichnis-Browser) verwendet. Sie erlaubt auch das Finden von Text in PDF-Dokumenten u. a.
Try to turn warnings on and you will see:
binmode() on unopened filehandle Source_File at ....

then fix it like this:
- binmode(Source_File);
+ binmode(SourceFile);

and you will got the expected result.

--
kmx


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.