SA Bugzilla – Bug 7880
Can't call method "name" on an undefined value at lib/Mail/SpamAssassin/Message/Node.pm line 533 (nullref exception)
Last modified: 2021-01-19 19:02:17 UTC
r1864393 introduced a nullref weakness in a Node.pm debug message that triggers when a UTF-16 header (or, presumably, body part) is too short for detect_utf16() to be able to detect the endianness from the encoded data (or, presumably, when it cannot detect the endianness for some other reason). This occurs even if the UTF-16 data includes a BOM. 3.4 does not have this nullref weakness as the debug message change was not backported. Repro: Put this header in a test message: From:=?UTF-16?B?//492Enc?= DermaCorrect <@ewFXg.maclostech320.xyz;live.de;> (note: malformed header is verbatim from actual spam)
1. Modify test data to include a "short UTF-16" header case observed in-the-wild that triggered this bug, verify test on unmodified Node.pm fails. 2. Modify Node.pm _normalize() to behave safely if detect_utf16() cannot determine the endianness of the data. 3. Modify detect_utf16() to skip the data scan if a BOM is present (for efficiency, as Perl's UTF-16 decoder will figure out the endianness from the BOM) 4. Verify test from 1 now passes 5. Verify example from bug 7252 still works properly Modified: .../trunk/lib/Mail/SpamAssassin/Message/Node.pm Modified: .../trunk/t/data/nice/unicode2 Committed revision 1885696.