Null pointer dereference when saving ftp resource to disk Topic is solved

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
User avatar
Veit Kannegieser
Moongazer
Moongazer
Posts: 10
Joined: 2019-03-23, 19:16

Null pointer dereference when saving ftp resource to disk

Unread post by Veit Kannegieser » 2021-01-09, 15:59

Hello,
i see Pale Moon debian, 64 bit closing when saving a ftp resource to local disk.
Starting in safe mode, or creating a new profile did not help.
I work with local ftp servers here, but it is also reproducible using
<ftp://ftp.elf.stuba.sk/HEADER.txt>
Attachments
edb showing dereference of zero rdi
edb showing dereference of zero rdi
gdb.log
gdb log with backtrace
(6.24 KiB) Downloaded 8 times

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2193
Joined: 2018-05-05, 13:29

Re: Null pointer dereference when saving ftp resource to disk

Unread post by vannilla » 2021-01-09, 16:03

I'm not getting anything when I try to save the file to disk.
Can you tell us the steps you take when it happens?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35631
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Null pointer dereference when saving ftp resource to disk

Unread post by Moonchild » 2021-01-09, 16:15

Confirmed, this is a crash in the DOM security check for ftp subresource loading.
You can work around it by disabling the crashing check: Set pref security.block_ftp_subresources to false.
Opened Issue #1710 (UXP) to track this.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2193
Joined: 2018-05-05, 13:29

Re: Null pointer dereference when saving ftp resource to disk

Unread post by vannilla » 2021-01-09, 17:37

After reading the issue description I got the crash too.
In my previous message I used the "Save Link As..." entry of the context menu on the provided link, so until the fix is out you can also work around the crash that way, if you don't want to mess with about:config.

New Tobin Paradigm

Re: Null pointer dereference when saving ftp resource to disk

Unread post by New Tobin Paradigm » 2021-01-09, 19:04

Even worse for me cause reasons I outlined in the issue.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35631
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Null pointer dereference when saving ftp resource to disk

Unread post by Moonchild » 2021-01-09, 19:30

Crash fix will be in the next release.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vicyclefive

Re: Null pointer dereference when saving ftp resource to disk

Unread post by vicyclefive » 2021-01-18, 05:58

1

You have a race condition:

You call f.isDirectory(), which returns true.
I replace the directory at path with some ordinary file.
You call f.listFiles(), which returns null.
To avoid this, say File[] files = f.listFiles(); unconditionally, and then change your if to if (files != null).

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35631
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Null pointer dereference when saving ftp resource to disk

Unread post by Moonchild » 2021-01-18, 07:43

Not sure what your post is about because it's lacking all context -- and has nothing at all to do with the code where this crash occurred.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2193
Joined: 2018-05-05, 13:29

Re: Null pointer dereference when saving ftp resource to disk

Unread post by vannilla » 2021-01-18, 11:39

I think it's about non-atomic file operations, in that if the process scheduler swaps processes between the isDirectory and listFiles calls, a malicious process can create a failure in the browser.
Of course this does not explain why it was posted in this thread.

User avatar
Veit Kannegieser
Moongazer
Moongazer
Posts: 10
Joined: 2019-03-23, 19:16

Re: Null pointer dereference when saving ftp resource to disk

Unread post by Veit Kannegieser » 2021-02-04, 00:52

Moonchild wrote:
2021-01-09, 19:30
Crash fix will be in the next release.
Works nice in 29.0.0.
Thank you!

Locked