Codebase list libpdf-api2-perl / 854de60
Validate $num and $gen arguments to read_objnum Steve Simms 7 years ago
1 changed file(s) with 5 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
156156
157157 my $readDebug = 0;
158158
159 use Carp;
159160 use IO::File;
160161
161162 # Now for the basic PDF types
696697
697698 sub read_objnum {
698699 my ($self, $num, $gen, %opts) = @_;
700 croak 'Undefined object number in call to read_objnum($num, $gen)' unless defined $num;
701 croak 'Undefined object generation in call to read_objnum($num, $gen)' unless defined $gen;
702 croak "Invalid object number '$num' in call to read_objnum" unless $num =~ /^[0-9]+$/;
703 croak "Invalid object generation '$gen' in call to read_objnum" unless $gen =~ /^[0-9]+$/;
699704
700705 my $object_location = $self->locate_obj($num, $gen) || return;
701706 my $object;