From: nwf Date: Mon, 3 Aug 2009 04:06:44 +0000 (-0400) Subject: Make HuffmanCoder's decoder bail if input is malformed X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=43f5bfb0d04f8e0011f2617e1342d7f689750484;p=instirc Make HuffmanCoder's decoder bail if input is malformed Ignore-this: 618be964b9e3f6f3649ac8b09b123b04 darcs-hash:20090803040644-4d648-f7bbbef6e3dac4805cf571da9135c3fffcba3470.gz --- diff --git a/HuffmanCoder.pm b/HuffmanCoder.pm index 57f61cb..0cd4118 100644 --- a/HuffmanCoder.pm +++ b/HuffmanCoder.pm @@ -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);