Skip Menu |

This queue is for tickets about the Graphics-ColorNames CPAN distribution.

Report information
The Basics
Id: 54500
Status: resolved
Priority: 0/
Queue: Graphics-ColorNames

People
Owner: rrwo [...] cpan.org
Requestors: CFAERBER [...] cpan.org
Cc:
AdminCc:

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



Subject: ambiguity between module and file names in TIEHASH
Date: Thu, 11 Feb 2010 00:42:58 +0100
To: bugs-Graphics-ColorNames [...] rt.cpan.org
From: Claus Färber <CFAERBER [...] cpan.org>
Hi! The but reported against Color::Calc seems to be a bug/design error in Graphics::ColorNames: It there's a file named 'X' in current directory, the scheme name 'X' becomes ambiguous: It can both refer to a scheme from file 'X' and to the scheme defined in Graphics::ColorNames::X. (The same is obviously true for other schemes such as 'HTML'). The result is that any application using Graphics::ColorNames and might suddenly behave in unexpected ways. In some applications, this might even introduce HTML injection problems: If the current directory is untrusted, the color names and values are under control of an untrusted source and might be used for HTML/code injection attacks. I'm not sure how that could be fixed: If module names just took precedence over filenames (ie if the order is reversed in sub TIEHASH), the ambiguity is not really solved: If, say, 'Graphics::ColorNames::FancyScheme' is not installed, the file './FancyScheme' (or './Graphics::ColorNames::FancyScheme') might still be read. Further, it might break existing apps. The best way IMO is to create a new interface that clearly separates the namespaces for files and modules. Claus PS: The patch for Color::Calc, which just omits the scheme name, actually works because 'X' is the default in Graphics::ColorNames. Anfang der weitergeleiteten E-Mail: Show quoted text
> Von: sunnavy <sunnavy@****.com> > Datum: 2010-02-09 14:27:54 MEZ > An: CFAERBER@cpan.org > Betreff: maybe a bug of Color::Calc? > > Hi Claus > > I encountered an interesting situation when I try to "use Color::Calc" today, > if I have an *not* empty file named "X" in current work directory, then > perl get died with a msg like this: > substr outside of string at /opt/perl-5.10.1/lib/site_perl/5.10.1/Graphics/ColorNames.pm line 313, <GEN0> line 1. > Missing color name at lib/Color/Calc.pm line 76 > > After a while's tracing, I found the problem is in the tie statement in new > method: > tie %ColorNames, 'Graphics::ColorNames', ($self->{'ColorScheme'} || 'X'); > this will cause Graphics::ColorNames to read the "X" file if $self->{ColorScheme} > is false, the fix is easy: just don't set "X" explicitly :P, patch is attached. > > best wishes > sunnavy

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

Show quoted text
>
Subject: Re: [rt.cpan.org #54500] AutoReply: ambiguity between module and file names in TIEHASH
Date: Thu, 11 Feb 2010 00:53:50 +0100
To: bug-Graphics-ColorNames [...] rt.cpan.org
From: Claus Färber <CFAERBER [...] cpan.org>
Graphics::ColorObject also triggers this bug if -r './X': t/object-orientated................ok 1/49 # Failed test 'no warnings' # at /opt/local/lib/perl5/site_perl/5.8.9/Test/NoWarnings.pm line 45. # There were 3 warning(s) # Previous test 24 '' # Use of uninitialized value in bitwise or (|) at /opt/local/lib/perl5/site_perl/5.8.9/Graphics/ColorNames.pm line 328, <GEN0> line 1. # at /opt/local/lib/perl5/site_perl/5.8.9/Graphics/ColorNames.pm line 328 # Graphics::ColorNames::_load_scheme_from_file('Graphics::ColorNames=HASH(0x100ae5ac0)', 'X') called at /opt/local/lib/perl5/site_perl/5.8.9/Graphics/ColorNames.pm line 101 # Graphics::ColorNames::TIEHASH('Graphics::ColorNames', 'HTML', 'Windows', 'Netscape', 'X') called at /opt/local/lib/perl5/site_perl/5.8.9/Graphics/ColorObject.pm line 1902 # require Graphics/ColorObject.pm called at t/object-orientated.t line 37 # eval {...} called at t/object-orientated.t line 37