Do not abort on decoder stack overflow.
authorWerner Koch <wk@gnupg.org>
Thu, 9 Apr 2015 09:50:03 +0000 (11:50 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 9 Apr 2015 09:50:03 +0000 (11:50 +0200)
commit07116a314f4dcd4d96990bbd74db95a03a9f650a
tree26fe86e219f407c526f959416a3ab0e62fb1856e
parentaea7b6032865740478ca4b706850a5217f1c3887
Do not abort on decoder stack overflow.

* src/ber-decoder.c (push_decoder_state, pop_decoder_state): Return an
error code.
(set_error): Prefix error message with "ksba:". Act on new return code.
(decoder_next): Act on new return code.
--

This changes the behaviour from

  gpgsm: unknown hash algorithm '1.8.48.48.48.48.48.48.48.48'
  gpgsm: detached signature w/o data - assuming certs-only
  ERROR: decoder stack overflow!
  Aborted

to

  gpgsm: detached signature w/o data - assuming certs-only
  ksba: ber-decoder: stack overflow!
  gpgsm: ksba_cms_parse failed: Limit reached

Use "gpgsm --verify FILE" to exhibit the problem.  FILE is
-----BEGIN PGP ARMORED FILE-----

MDAGCSqGSIb3DQEHAqCAMDACAQExDzANBgkwMDAwMDAwMDAwADCABgkwMDAwMDAw
MDAAMDEwoIGTMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAjMDA=
=PQdP
-----END PGP ARMORED FILE-----

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
src/ber-decoder.c