Skip Menu |

This queue is for tickets about the SNMP-MIB-Compiler CPAN distribution.

Report information
The Basics
Id: 15433
Status: new
Priority: 0/
Queue: SNMP-MIB-Compiler

People
Owner: Nobody in particular
Requestors: dnm17 [...] columbia.edu
Cc:
AdminCc:

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



Subject: de-referencing scalar as hash reference
SNMP-MIB-Compiler-0.06 generates the error: Can't use string ("1") as a HASH ref while "strict refs" in use at ~/lib/SNMP-MIB-Compiler-0.06/lib/SNMP/MIB/Compiler.pm line 1264. The corresponding line in the MIB is: ... fspSwUpgradeIndex OBJECT-TYPE SYNTAX Integer32 (1) <-- MAX-ACCESS not-accessible STATUS current DESCRIPTION ... If this were an INTEGER, it would be handled properly. But for Integer32, there is no check against the reference, so the scalar is directly used as a hash reference, which causes the error above. The patch merely duplicates the code for the INTEGER check, although it might be better to refer to INTEGER and Integer32 in the same block of code.
--- Compiler.pm 1999-09-05 17:55:04.000000000 -0400 +++ /ms/user/m/medinad/lib/SNMP-MIB-Compiler-0.06/lib/SNMP/MIB/Compiler.pm 2005-10-31 15:06:54.000000000 -0500 @@ -1261,7 +1261,19 @@ elsif ($token == $IDENTIFIER || $token == $TYPEMODREFERENCE) { my $type = $value; my $subtype = $self->parse_subtype(); - $$subtype{'type'} = $type; + my $ref = ref $subtype; + if (defined $ref && $ref eq 'HASH') { + $$subtype{'type'} = $type; + } + else { + if (defined $subtype) { + return { 'value' => $subtype, + 'type' => $type }; + } + else { + return { 'type' => $type }; + } + } return $subtype; } else {