xattr: fix crash on dangling symlinks

Authored by iasensio on Dec 12 2019, 8:48 PM.

Description

xattr: fix crash on dangling symlinks

Summary:
When requesting metadata on a dangling symlink, the framestack ends up calling
k_queryAttributes() with the symlink path, where the listxattr syscall
returns size==-1 and errno==ENOENT (No such file or directory).
This case was not covered before, and provoked a segfault on QByteArray.
Full traceback on: https://bugs.kde.org/show_bug.cgi?id=414227

It might be also a good idea to always protect the function when size==-1

BUG: 414227

Test Plan:

  • bin/usermetadatawritertest : added test
  • On dolphin, with panel information open, hover over a dangling symlink

Reviewers: astippich, bruns

Reviewed By: bruns

Subscribers: bruns, kde-frameworks-devel, Baloo

Tags: Frameworks, Baloo

Differential Revision: https://phabricator.kde.org/D25414

Details

Committed
iasensioDec 12 2019, 8:50 PM
Reviewer
bruns
Differential Revision
D25414: xattr: fix crash on dangling symlinks
Parents
R286:c2a51b75194b: GIT_SILENT Upgrade ECM and KF5 version requirements for 5.65.0 release.
Branches
Unknown
Tags
Unknown