]> hydra-www.ietfng.org Git - instirc/commitdiff
Make HuffmanCoder's decoder bail if input is malformed
authornwf <nwf@cs.jhu.edu>
Mon, 3 Aug 2009 04:06:44 +0000 (00:06 -0400)
committernwf <nwf@cs.jhu.edu>
Mon, 3 Aug 2009 04:06:44 +0000 (00:06 -0400)
Ignore-this: 618be964b9e3f6f3649ac8b09b123b04

darcs-hash:20090803040644-4d648-f7bbbef6e3dac4805cf571da9135c3fffcba3470.gz

HuffmanCoder.pm

index 57f61cbcd82ca75109504bc91e0fa2afc012bf1d..0cd4118c6418d950380aa947222742fc9090744b 100644 (file)
@@ -130,6 +130,7 @@ sub decode($$) {
   while ($inst ne "") {
     my $tbl = $$self{'dt'};
     while (!_is_char($tbl)) {
+      return undef if length $inst < 1;
       my $code = substr($inst, 0, 1);
       $inst = substr($inst, 1);
       $tbl = _decode_char($ccr, $code, $tbl);