mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
fix(safety): harden dual-core atomics, UDP peer filtering, TOCTOU, and CRC-8 UART frames
This commit is contained in:
1 parent
426ab7c7d6
commit
c0bad51d3b
9 files changed
+232
-72
No files matched your search
+5
-4
@@ -258,14 +258,14 @@ impl SteamFrameGpuiApp {
|
||||
}
|
||||
self.latest_controller = mon.latest_controller.clone();
|
||||
|
||||
// Ne cloner et décoder la trame QUE si l'onglet Cockpit est actif !
|
||||
let frame_data: Option<(u32, u32, Vec<u8>)> = if self.active_tab == ActiveTab::Cockpit
|
||||
// Ne cloner que le pointeur Arc sous verrou ; la copie/conversion BGRA se fait hors verrou !
|
||||
let frame_data: Option<(u32, u32, Arc<Vec<u8>>)> = if self.active_tab == ActiveTab::Cockpit
|
||||
&& mon.preview_frame_seq != self.last_frame_seq
|
||||
&& !mon.preview_rgba.is_empty()
|
||||
&& mon.preview_width > 0
|
||||
&& mon.preview_height > 0
|
||||
{
|
||||
Some((mon.preview_width, mon.preview_height, mon.preview_rgba.clone()))
|
||||
Some((mon.preview_width, mon.preview_height, Arc::clone(&mon.preview_rgba)))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -274,7 +274,8 @@ impl SteamFrameGpuiApp {
|
||||
}; // Verrou `engine_monitor` immédiatement libéré !
|
||||
|
||||
// 2. Conversion BGRA et allocation GPU hors du verrou monitor
|
||||
if let Some((w, h, mut raw_buf)) = new_frame_data {
|
||||
if let Some((w, h, raw_arc)) = new_frame_data {
|
||||
let mut raw_buf = (*raw_arc).clone();
|
||||
for pixel in raw_buf.chunks_exact_mut(4) {
|
||||
pixel.swap(0, 2);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user