Branch: Tag:

2014-10-16

2014-10-16 16:39:33 by Arne Goedeke <el@laramies.com>

_Roxen.http_decode_string: do not overflow

9:   test_eq(_Roxen.http_decode_string("abc+d%20e%41"), "abc+d eA")   test_eq(_Roxen.http_decode_string(""), "")   test_eq(_Roxen.http_decode_string("+"), "+") - test_do(_Roxen.http_decode_string("%")) - test_do(_Roxen.http_decode_string("%0")) - test_do(_Roxen.http_decode_string("%%")) - test_do(_Roxen.http_decode_string("%%%")) - test_do(_Roxen.http_decode_string("%41%")) - test_do(_Roxen.http_decode_string("%41%0")) - test_do(_Roxen.http_decode_string("%41%%")) - test_do(_Roxen.http_decode_string("%41%%%")) - test_do(_Roxen.http_decode_string("%u")) - test_do(_Roxen.http_decode_string("%u0")) - test_do(_Roxen.http_decode_string("%u00")) - test_do(_Roxen.http_decode_string("%u000")) - test_do(_Roxen.http_decode_string("%u000_")) - test_do(_Roxen.http_decode_string("%41%u")) - test_do(_Roxen.http_decode_string("%41%u0")) - test_do(_Roxen.http_decode_string("%41%u00")) - test_do(_Roxen.http_decode_string("%41%u000")) - test_do(_Roxen.http_decode_string("%41%u000_")) +  + # the following inputs are all illegal + test_eval_error(_Roxen.http_decode_string("%")) + test_eval_error(_Roxen.http_decode_string("%0")) + test_eval_error(_Roxen.http_decode_string("%%")) + test_eval_error(_Roxen.http_decode_string("%%%")) + test_eval_error(_Roxen.http_decode_string("%41%")) + test_eval_error(_Roxen.http_decode_string("%41%0")) + test_eval_error(_Roxen.http_decode_string("%41%%")) + test_eval_error(_Roxen.http_decode_string("%41%%%")) + test_eval_error(_Roxen.http_decode_string("%u")) + test_eval_error(_Roxen.http_decode_string("%u0")) + test_eval_error(_Roxen.http_decode_string("%u00")) + test_eval_error(_Roxen.http_decode_string("%u000")) + test_eval_error(_Roxen.http_decode_string("%u000_")) + test_eval_error(_Roxen.http_decode_string("%41%u")) + test_eval_error(_Roxen.http_decode_string("%41%u0")) + test_eval_error(_Roxen.http_decode_string("%41%u00")) + test_eval_error(_Roxen.http_decode_string("%41%u000")) + test_eval_error(_Roxen.http_decode_string("%41%u000_")) +    test_eq(_Roxen.http_decode_string("%u12345"), "\x1234""5")   test_eq(_Roxen.http_decode_string("%U12345"), "\x1234""5")