Closed Bug 529953 Opened 15 years ago Closed 5 years ago

Pasting a text that contains 0x00 characters causes mail to be truncated

Categories

(Thunderbird :: Message Compose Window, defect)

24 Branch
x86
macOS
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 495404

People

(Reporter: piotr, Unassigned)

References

(Depends on 2 open bugs)

Details

(Keywords: dataloss, Whiteboard: [dupeme, see dependencies])

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; pl; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: 2.0.0.23 (20090812)

When clipboard contains text that has 0x0A character (linux LF) and that text is pasted into mail body, then the mail body is truncated when sent. The truncation happens a line after where this problematic text is pasted. 

In edit-time there's no problem, everything is okey, but when you hit Send button, the message is delivered in truncated state and the 'sent' folder contains that mail with truncated body. 

Reproducible: Always

Steps to Reproduce:
1. Open Thunderbird, Compose a new plain-text email with encoding: ISO-8859-2 (haven't tried other encodings, or html mail composition) 
2. Try to place a text that contains 0x0A character into clipboard. It might be hard, for this I have used: VirtualBox + Windows XP as guest, then opened FAR Manager and opened a text file with unix/linux line ends, selected whole line or two, copied into clipboard, thanks to VirtualBox system addons the text was present in native/host clipboard 
3. Go back to Thunderbird, enter some text in message body, paste the text, hit enter, enter some additional text below. 
4. Hit Send button, check the email in Sent folder
5. The fragment below inserted text is lost in that mail - check the email that was sent, look at Sent folder.
Actual Results:  
The fragment below inserted text is lost in that mail - check the email that was sent, look at Sent folder.

Expected Results:  
No text should vanish when inserted text contains 0x0A character

Here is the text I copied and pasted into TB, the view from hex editor:
0000000000: 67 6F 32 0A             │                          go2◙

When text on right side is selected, including some white characters on its right (or multiple such line) and copied as is (read: when nothing filters out those white characters and 0x0A is placed in clipboard) then TB destroys the mail body.

- Thunderbird version is stated above, I will add that it is a Polish version.
- MacOSX version: 10.6.2 (also Polish localization)

Tools I used to reproduce the bug: (currently I do not have the idea how to reproduce it using native programs etc)
- VirtualBox: 3.0.12 
- Guest operating system on VirtualBox: Windows XP SP3
- FAR 1.7
I've just fought, as MacOSX nowadays uses LF (0x0A) too, so virtually there should be no problem with that character... I don't know what is happening behind scenes, but it might be that VirtualBox converts this character into something else - I've no tools to debug it. 

If you had any tool that can dump the clipboard contents to file I could test it and feed it back to you.
(In reply to comment #1)

> 
> If you had any tool that can dump the clipboard contents to file I could test
> it and feed it back to you.

Not to my knwoledge ....

Is the issue still present in 3.0 nigthly builds ?
Version: unspecified → 2.0
Summary: Pasting a text that contains certain characters (0x0A for sure) causes mail to be truncated → Pasting a text that contains 0x00 characters causes mail to be truncated
I haven't test on 3.0 nightly yet, will try today or tomorrow. 

However, I've investigated the issue more carefully. I found that pbpaste and pbcopy CLI tools can dump/insert test from/to clipboard, that was helpful to reproduce the bug without need to have Virtualbox & Windows. The source of the seems to be that Virtualbox/Windows/FAR inserts 0x00 characters somewhere into clipboard - pbpaste showed nothing interesting - the dumped clipboard looked completely the same as the copied text within VB/Win/FAR. So, I got to the point that the 0x0A character it is not a problem for TB. 

So, I thought, that it might be that 0x00 is placed into clipboard... I've created a file with text and some 0x00 characters (Hex Editor view):

0000000000: 7A 7A 7A 00 00 00 00 00 │ 00 00                    zzz
 
Then, I issued the following CLI command:
pbcopy < file.txt

so the content of file.txt is placed into clipboard, then started to edit new message in TB, pasted text, in new line entered some text, then clicked Sent button. The message in Sent folder is truncated just after the text that was inserted!

I hope it will help you fix the problem.

Remark #1: pbpaste and pbcopy are macosx default command line tools, they are also present, i think, in linux. 

Remark #2: I was not able to trace what VirtualBox/Win/FAR places in clipboard that makes TB to corrupt the email, since the dumped text is binary the same as the copied text. It might be that there are multiple clipboard versions in system (plain-text, rtf, some others), and it might be that pbpaste dumped one of these versions, whereas TB inserts from the other.... Nonetheless, pbcopy can be used to reproduce the problem, I think the fix will also solve the problem with VB/Win/FAR.
> Is the issue still present in 3.0 nigthly builds ?

I found time to check nightly build (not recent, but fresh enough: 20091121) and the described issue *is* present there, too.

The version I've checked is:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; pl; rv:1.9.1.5) Gecko/20091121 Thunderbird/3.0

Remark:
This bug can be also reproduced w/o actually sending mail, just save it as draft, then view that draft - the mail content is truncated, right after pasted text.
xre bug 477799 and bug 495404, for ease of search and tracking.
Depends on: 477799, 495404
Re-checked on the newest stable version of Thunderbird:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; pl; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

MacOSX version: 10.6.7


The problem still exists. 
BTW: I guess, a simple trim on pasted content would fix the issue.
(In reply to comment #2)
> (In reply to comment #1)
> 
> > 
> > If you had any tool that can dump the clipboard contents to file I could test
> > it and feed it back to you.
> 
> Not to my knwoledge ....

http://lmgtfy.com/?q=mac+clipboard+tool
(In reply to comment #7)
> http://lmgtfy.com/?q=mac+clipboard+tool

I've already added a comment where I pointed out that under MacOSX anyone can use pbpaste & pbcopy cli tools available by default there. So, this brilliant hint using Google ain't helpful.
any reason to note dupe this to one of thee dependencies?
Severity: normal → critical
Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(bugzilla2007)
Keywords: dataloss
Since I can see some movements regarding this issue, I want to inform that the issue is still present.
What's more, I've stumbled across this problem recently when I tried to paste some text copied from PDF what was opened using Preview (built-in OSX app). Using pbpaste I dumped the clipboard content and I found out that 0x00 characters are there.

TB didn't paste the text then when tried to send the email it displayed some misleading information that SMTP server timeout. I saved the email as draft and examined - the 0x00 character caused the email to get truncated.

I've attached 2 screenshots illustrating the above behaviour.


TB: 24.1.1
MacOSX: 10.9
Version: 2.0 → 24
Screenshot how composing and sending looks like when a text with 0x00 bytes was pasted
Attachment #8339423 - Flags: feedback+
Attached image How draft email looks like (deleted) —
How draft email looks like when 0x00 bytes have been pasted.
Flags: needinfo?(mkmelin+mozilla)
(In reply to Wayne Mery (:wsmwk) from comment #9)
> any reason to note dupe this to one of thee dependencies?

I'm fine with that from the look of summaries, but I won't go into the details of this to find out more.
Flags: needinfo?(bugzilla2007)
Whiteboard: [dupeme, see dependencies]
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: