ArrayIndexOutOfBoundsException while processing some trap varbinds

Description

Steps to reproduce:

  1. Start up OpenNMS with Trapd enabled (default case)

  2. Send a trap with at least one octet-string varbind containing a series of characters that does not parse as UTF-8 text. The sequence 4f5ffa95 in the following command serves as an example:

Expected result: Trap ingested silently and turned into an event

Actual result: No event is created, and the following appears in trapd.log:

Environment

See https://mynms.opennms.com/Ticket/Display.html?id=4801

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Jeff Gehlbach November 29, 2016 at 10:10 AM

Jeff Gehlbach November 28, 2016 at 4:07 PM

Varbind processing goes off the rails when presented with an octet-string containing a sequence that's not valid UTF-8. This happens because we try to treat the data as UTF-8, and attempt to determine whether the whole sequence is printable, with no exception handling. Wrapping the printable method call in a try / catch block, and assuming it's not printable in case we catch an ArrayIndexOutOfBoundsException, enables processing to continue.

Fixed

Details

Assignee

Reporter

Labels

Sprint

Affects versions

Priority

PagerDuty

Created November 28, 2016 at 3:56 PM
Updated June 9, 2020 at 2:30 PM
Resolved January 3, 2017 at 2:38 PM