Bug 497994

Summary: Krfb crashes on start after "Remote control requested" dialog
Product: [Applications] krfb Reporter: Ivan Savu <ivan.savu>
Component: generalAssignee: George Goldberg <grundleborg>
Status: REPORTED ---    
Severity: crash    
Priority: NOR    
Version First Reported In: 24.08.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ivan Savu 2024-12-28 18:45:47 UTC
SUMMARY
Krfb segfaults immediately after clicking "Share" in the "Remote control requested" dialog on start. The backtrace points to krfb-24.08.3/framebuffers/pipewire:377.

The relevant code is as follows:

// FIXME: Assuming stride == width * 4, not sure to which extent this holds
setVideoSize(frame.dataFrame->size);
memcpy(q->fb, frame.dataFrame->data, frame.dataFrame->size.width() * frame.dataFrame->stride);

It seems there might be an issue with the calculation of the framebuffer size. If stride equals width * 4, then the current code appears to multiply width twice (width*stride). As a test, I changed the calculation to use size.height()*stride instead, and this modification appears to resolve the issue, though I am not certain this is the correct solution or explanation.

STEPS TO REPRODUCE
1. Launch Krfb.
2. Click "Share" when the "Remote control requested" dialog appears.

OBSERVED RESULT
Krfb segfaults immediately after clicking "Share."

EXPECTED RESULT
The application should proceed to share the screen without crashing.

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: 
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.3

ADDITIONAL INFORMATION
Pipewire version 1.2.6