Skip to content
Snippets Groups Projects
Commit 09203fe7 authored by Martin Nilsson's avatar Martin Nilsson Committed by Henrik (Grubba) Grubbström
Browse files

Prevent infinite loops when decoding incomplete data.

parent 9d3bdde5
No related branches found
No related tags found
No related merge requests found
...@@ -218,7 +218,7 @@ mapping(int:program(.Types.Object)) universal_types = ...@@ -218,7 +218,7 @@ mapping(int:program(.Types.Object)) universal_types =
mapping(int:program(.Types.Object))|void types) mapping(int:program(.Types.Object))|void types)
{ {
types = types ? universal_types+types : universal_types; types = types ? universal_types+types : universal_types;
return der_decode(Stdio.Buffer(data), types); return der_decode(Stdio.Buffer(data)->set_error_mode(1), types);
} }
//! Works just like @[simple_der_decode], except it will return //! Works just like @[simple_der_decode], except it will return
......
...@@ -2,6 +2,8 @@ START_MARKER ...@@ -2,6 +2,8 @@ START_MARKER
test_do( add_constant("Types", Standards.ASN1.Types); ) test_do( add_constant("Types", Standards.ASN1.Types); )
test_eval_error(Standards.ASN1.Decode.simple_der_decode(""))
define(test_decode,[[ define(test_decode,[[
test_eq(sprintf("%O",Standards.ASN1.Decode.simple_der_decode(String.hex2string($1-" ")))-"Standards.ASN1.",$2) test_eq(sprintf("%O",Standards.ASN1.Decode.simple_der_decode(String.hex2string($1-" ")))-"Standards.ASN1.",$2)
test_eq(Standards.ASN1.Decode.simple_der_decode(String.hex2string($1-" "))->get_der(), test_eq(Standards.ASN1.Decode.simple_der_decode(String.hex2string($1-" "))->get_der(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment