RealRaven2000 / quickFilters

Thunderbird Add-on: quickFilters
http://quickfilters.quickfolders.org/
Other
46 stars 11 forks source link

Creating filters - extracting headers can fail if msg > 16kByte #206

Closed RealRaven2000 closed 10 months ago

RealRaven2000 commented 10 months ago

Important problem - when reading the headers (especially custom headers such as "delivered-to") from an email, adding the search term may fail if the email > 16kb. This may both happen when using the "mailing list" template and when using a custom template.

When this error condition happens, the filter assistant is not able to extract data from the headers of the original email

image

This is due to the following bug in quickFilters.clsGetHeaders.read()

      while (inputStream.available()) { 
        msgContent = msgContent + inputStream.read(2048); 
        let p = msgContent.search(/\r\n\r\n|\r\r|\n\n/); //todo: it would be faster to just search in the new block (but also needs to check the last 3 bytes)
        if (p > 0) {
          contentCache = msgContent.substr(p + (msgContent[p] == msgContent[p+1] ? 2 : 4));
          msgContent = msgContent.substr(0, p) + "\r\n";
          break;
        }
        if (msgContent.length > 2048 * 8) {
          util.logDebug('clsGetHeaders - early exit - msgContent length>16kB: ' + msgContent.length);
          return null;
        }
      }

this should not be return null but simply break - because otherwise the whole structure CurrentHeader.headers is not initialized.

RealRaven2000 commented 10 months ago

quick fix versions:

ESR 102: quickFilters-wx-5.9.4pre3.zip

ESR 115: quickFilters-wx-6.2pre61.zip


To one of the versions above download the correct zip file and drag it into Add-ons Manager (do not extract contents or it won't install).

RealRaven2000 commented 10 months ago

fixed in 6.2 - Published 13/08/2023, also backported to 5.9.4, same day