Ristretto crash when using AFP network file

Bug #1967618 reported by Karim BAKKAL
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ristretto (Ubuntu)
Invalid
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned
Jammy
Invalid
Undecided
Unassigned
Lunar
Invalid
Undecided
Unassigned

Bug Description

[Impact]

Ristretto crashes when opening certain directories with files that have unknown (non-standard) extensions.

[Test Case]

Create a directory and create a file.azerty file in it.
Use the ristretto viewer to open the directory and observe if the application crashes.

[Regression Potential]

This only adds a null check so there should be no regression potential. If anything would go wrong though, it would be in directory viewing - could potentially show no images there.

[Original Description]

Hello,

When i use file from AFP network (apple), the viewer crash. No crash copied from the network directory to the desktop.

Tried with multiple folders.

dbg backtrace give this :
Starting program: /usr/bin/ristretto
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff51c2700 (LWP 19324)]
[New Thread 0x7ffff499f700 (LWP 19325)]
[New Thread 0x7fffed2fe700 (LWP 19341)]
[New Thread 0x7fffecaa9700 (LWP 19342)]
[New Thread 0x7fffe3fff700 (LWP 19343)]
[New Thread 0x7fffe37fe700 (LWP 19344)]
[New Thread 0x7fffe2ffd700 (LWP 19353)]
[New Thread 0x7fffe27fc700 (LWP 19362)]
[New Thread 0x7fffe1ffb700 (LWP 19368)]
[New Thread 0x7fffe17fa700 (LWP 19370)]
[New Thread 0x7fffe0ff9700 (LWP 19371)]
[Thread 0x7fffe0ff9700 (LWP 19371) exited]
[Thread 0x7fffe17fa700 (LWP 19370) exited]
[Thread 0x7fffe1ffb700 (LWP 19368) exited]
[Thread 0x7fffe27fc700 (LWP 19362) exited]
[Thread 0x7fffe2ffd700 (LWP 19353) exited]
[Thread 0x7fffecaa9700 (LWP 19342) exited]
[Thread 0x7fffed2fe700 (LWP 19341) exited]

Thread 1 "ristretto" received signal SIGSEGV, Segmentation fault.
0x000055555556aed7 in ?? ()
(gdb) backtrace
#0 0x000055555556aed7 in ()
#1 0x00007ffff7715f4d in () at /lib/x86_64-linux-gnu/libgdk-3.so.0
#2 0x00007ffff721f04e in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff721f400 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007ffff721f6f3 in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x00007ffff7a3812d in gtk_main () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#6 0x000055555556978c in ()
#7 0x00007ffff6cb8083 in __libc_start_main (main=0x5555555695c0, argc=1, argv=0x7fffffffe068, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffe058) at ../csu/libc-start.c:308
#8 0x00005555555698ae in ()
(gdb) bt full
#0 0x000055555556aed7 in ()
#1 0x00007ffff7715f4d in () at /lib/x86_64-linux-gnu/libgdk-3.so.0
#2 0x00007ffff721f04e in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff721f400 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007ffff721f6f3 in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x00007ffff7a3812d in gtk_main () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#6 0x000055555556978c in ()
#7 0x00007ffff6cb8083 in __libc_start_main (main=0x5555555695c0, argc=1, argv=0x7fffffffe068, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffe058) at ../csu/libc-start.c:308
        result = <optimised out>
        unwind_buf =
              {cancel_jmp_buf = {{jmp_buf = {93824992441792, 2107232891922312833, 93824992319616, 140737488347232, 0, 0, -2107232893011202431, -2107252854453277055}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x1, 0x7fffffffe068}, data = {prev = 0x0, cleanup = 0x0, canceltype = 1}}}
        not_first_call = <optimised out>
#8 0x00005555555698ae in ()

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: ristretto 0.10.0-1
ProcVersionSignature: Ubuntu 5.4.0-107.121-generic 5.4.174
Uname: Linux 5.4.0-107-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu27.22
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: XFCE
Date: Sat Apr 2 17:35:47 2022
InstallationDate: Installed on 2021-06-20 (286 days ago)
InstallationMedia: Xubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
SourcePackage: ristretto
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Karim BAKKAL (kabak-85) wrote :
Revision history for this message
Karim BAKKAL (kabak-85) wrote :

Also crash with SMB protocol.

Try to access network file using "/run/user/1000/gvfs/" and no crash.

Sean Davis (bluesabre)
Changed in ristretto (Ubuntu):
status: New → Confirmed
Revision history for this message
Karim BAKKAL (kabak-85) wrote :

I think i have find a clue.

When the viewer crash, i remove the file "Thumbs.db" (windows thumbnails database) and it work in most case.

If i try to create a file named "file.azerty" in this directory, it crash again.

I seems we have to use unsupported extension file on a network share to reproduce the crash.

Revision history for this message
Karim BAKKAL (kabak-85) wrote (last edit ):

Hello,

I'm a rookie in C++ programming and dbg but with a little work, i think i have a very simple fix.

How can i submit code and explanation for it ?

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Karim! I can, after slight modifications, sponsor your change for 20.04, but I would need someone to verify it once I sponsor it. Would you be able to do that?

description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I have sponsored your change for focal - all newer series are irrelevant as they seemed to have refactored the relevant code. Did a few small modifications to your change (minor ones), and since this is a patch on top of a debian package, I used quilt to generate a debian patch on top. I'd recommend reading up on the usage of quilt for the future!

If you're interested in how the package change looks now after all minor adjustments, here is the diff:
http://launchpadlibrarian.net/670860320/ristretto_0.10.0-1_0.10.0-1ubuntu0.1.diff.gz

I will mark all future series as irrelevant and only mark this for focal (20.04).
Thanks again for your contribution!

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ah, one more thing: can you take a look at the bug description's test case and see if it's correct? Since this is an SRU, we need to have a valid test case to test if the bug is fixed. More about those here:
https://wiki.ubuntu.com/StableReleaseUpdates

Changed in ristretto (Ubuntu Focal):
status: New → In Progress
Changed in ristretto (Ubuntu):
status: Confirmed → Invalid
Changed in ristretto (Ubuntu Jammy):
status: New → Invalid
Changed in ristretto (Ubuntu Lunar):
status: New → Invalid
Revision history for this message
Karim BAKKAL (kabak-85) wrote (last edit ):

For the "test case", you need to have images in the directory.

I build a package with the 4 archives in the upload queue and the bug is fix.

The only thing i saw is the version number in "help -> about" which stayed to 0.10.0 where apt say 0.10.0-1ubuntu0.1 .

Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Karim, or anyone else affected,

Accepted ristretto into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/ristretto/0.10.0-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in ristretto (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Karim BAKKAL (kabak-85) wrote (last edit ):

The proposed package fix the bug for me.

Tested with different directories with mixed content, thumbs.db and empty test file named "file.azerty".
Tested with zoom, rotate, thumbnail size, change sorting, select image by thumbnail list (click and mouse wheel).

apt-cache policy ristretto
ristretto:
  Installé : 0.10.0-1ubuntu0.1
  Candidat : 0.10.0-1ubuntu0.1
 Table de version :
 *** 0.10.0-1ubuntu0.1 500
        500 http://fr.archive.ubuntu.com/ubuntu focal-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     0.10.0-1 500
        500 http://fr.archive.ubuntu.com/ubuntu focal/universe amd64 Packages

Revision history for this message
Luís Infante da Câmara (luis220413) wrote (last edit ):

Marking as verified per comment #10.

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ristretto - 0.10.0-1ubuntu0.1

---------------
ristretto (0.10.0-1ubuntu0.1) focal; urgency=medium

  [ Karim BAKKAL ]
  * d/p/add-null-check.patch: Add a NULL value check. When the filetype is
    unknown, it's return a null value/pointer that make crash at the "strncmp"
    function (LP: #1967618).

 -- Łukasz 'sil2100' Zemczak <email address hidden> Tue, 06 Jun 2023 14:20:20 +0200

Changed in ristretto (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Chris Halse Rogers (raof) wrote : Update Released

The verification of the Stable Release Update for ristretto has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.