Closed Bug 1571076 Opened 5 years ago Closed 5 months ago

DNS.txt lookup from DNS.jsm can lead to 'malformed UTF-8' error

Categories

(MailNews Core :: Account Manager, defect, P5)

Tracking

(thunderbird_esr115 wontfix)

RESOLVED FIXED
128 Branch
Tracking Status
thunderbird_esr115 --- wontfix

People

(Reporter: pmorris, Assigned: clokep)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1349337 +++

From: https://bugzilla.mozilla.org/show_bug.cgi?id=1349337#c11

[...] the DNS.txt lookup doesn't seem to work generally.

var {DNS} = ChromeUtils.import("resource:///modules/DNS.jsm");
DNS.txt("thunderbird.net").then(recs => {
  alert(JSON.stringify(recs));
});

-> JavaScript error: resource:///modules/DNS.jsm, line 122: TypeError: malformed UTF-8 character sequence at offset 68

... and I thought you were lightning fast ;-) - Maybe a single highbit byte of windows-1252 slipped in. Read a bit about this stuff here:
https://wiki.mozilla.org/User:Jorgk/8-bit_bytes_and_e-mail_corruption_at_Verizon,_Yahoo,_etc.#A_brief_excursion_into_the_history_of_encodings
Quote: a single byte with the highest bit set is not valid in UTF-8

Keywords: checkin-needed
Version: unspecified → 60

We come from bug 1349337 here, so certainly unrelated to TB 60.

Version: 60 → Trunk

Any news on this? I hope it hasn't dropped off the radar.

Flags: needinfo?(paul)

I hadn't put this on my todo list since no one asked me to and it was not related to the work I did in bug 1349337 (which was adding MX lookups, whereas these TXT lookups already existed). It was just something mkmelin noticed. jorgk, I take it you would like me to put it on my todo list.

I just looked (to confirm what I remembered) and this code (a call to DNS.txt()) does not appear to be used in our code base, so we should set the priority accordingly. Lets say P4.

There's a TODO comment in DNS.jsm at line 162 that may be related:

 } else if (aTypeID == NS_T_TXT) {
      // TODO should only read dataLength characters.
      let data = ctypes.unsigned_char.ptr(aAnswer.addressOfElement(aIdx + 1));

      return new TXTRecord(data.readString());

https://searchfox.org/comm-central/source/mail/base/modules/DNS.jsm#162

Flags: needinfo?(paul)
Priority: -- → P4

Hmm, so if we don't call it, how did Magnus notice the failure in bug 1349337 comment #11? Was he exercising this in the console?

Yeah, I think so. The code he put in bug 1349337 comment #11 looks like something he entered in the console, not something from our code base.

Yeah I was just curious about the data received there, so just tried it out in the console while testing the other function.

Priority: P4 → P5
Severity: normal → S3
Duplicate of this bug: 1806416
See Also: → 1583053

I have a fix for this.

Assignee: nobody → clokep
Status: NEW → ASSIGNED
Duplicate of this bug: 1583053
No longer duplicate of this bug: 1583053
Attachment #9400978 - Attachment description: Bug 1571076 - FIx DNS TXT lookups when the answer contains multiple records. r=#thunderbird-reviewers → Bug 1571076 - Fix DNS TXT lookups when the answer contains multiple records. r=#thunderbird-reviewers

Pushed by daniel@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/cc1a90fd9304
Fix DNS TXT lookups when the answer contains multiple records. r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: