DNS.txt lookup from DNS.jsm can lead to 'malformed UTF-8' error
Categories
(MailNews Core :: Account Manager, defect, P5)
Tracking
(thunderbird_esr115 wontfix)
| 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
Comment 1•6 years ago
|
||
... 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
Updated•6 years ago
|
Comment 2•6 years ago
|
||
We come from bug 1349337 here, so certainly unrelated to TB 60.
Comment 3•6 years ago
|
||
Any news on this? I hope it hasn't dropped off the radar.
| Reporter | ||
Comment 4•6 years ago
|
||
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
Comment 5•6 years ago
|
||
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?
| Reporter | ||
Comment 6•6 years ago
|
||
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.
Comment 7•6 years ago
|
||
Yeah I was just curious about the data received there, so just tried it out in the console while testing the other function.
Updated•3 years ago
|
| Assignee | ||
Comment 9•2 years ago
|
||
I have a fix for this.
| Assignee | ||
Comment 11•2 years ago
|
||
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Comment 12•2 years ago
|
||
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
Updated•2 years ago
|
Updated•2 years ago
|
Description
•