https://bugs.kde.org/show_bug.cgi?id=480296

            Bug ID: 480296
           Summary: UB in plasma-workspace's ksmserver/legacy.cpp
                    (-Wrestrict with ::select)
    Classification: Plasma
           Product: plasmashell
           Version: master
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: plasma-b...@kde.org
          Reporter: s...@gentoo.org
                CC: k...@davidedmundson.co.uk
  Target Milestone: 1.0

SUMMARY

See
https://invent.kde.org/plasma/plasma-workspace/-/blob/034205dd9dc667f6abcf8fb8a53baa6094bb4449/ksmserver/legacy.cpp#L179
where ::select is called as:
>::select(fd + 1, &fds, nullptr, &fds, &tmwait);

This triggers a warning
```
 *
/var/tmp/portage/kde-plasma/plasma-workspace-6.0.49.9999/work/plasma-workspace-6.0.49.9999/ksmserver/legacy.cpp:179:30:
warning: passing argument 2 to ‘restrict’-qualified parameter aliases with
argument 4 [-Wrestrict]
```

with gcc version 14.0.1 20240121 (experimental) (Gentoo Hardened
14.0.1_pre20240121 p16) at least, and it looks right.

>From `select(3p`):
```
       int select(int nfds, fd_set *restrict readfds,
           fd_set *restrict writefds, fd_set *restrict errorfds,
           struct timeval *restrict timeout);
```

&fds is passed as both `readfds` and `errorfds` which is forbidden.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to