Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
debugger: Skip out-of-bounds breakpoints when deserializing (#28781)
Cole Millercd4a3fd679a1
diff --git a/crates/project/src/debugger/breakpoint_store.rs b/crates/project/src/debugger/breakpoint_store.rsindex 33cc3d30a2f..5cc361a73e4 100644--- a/crates/project/src/debugger/breakpoint_store.rs+++ b/crates/project/src/debugger/breakpoint_store.rs@@ -591,7 +591,13 @@ impl BreakpointStore {this.update(cx, |_, cx| BreakpointsInFile::new(buffer, cx))?;for bp in bps {- let position = snapshot.anchor_after(PointUtf16::new(bp.row, 0));+ let max_point = snapshot.max_point_utf16();+ let point = PointUtf16::new(bp.row, 0);+ if point > max_point {+ log::error!("skipping a deserialized breakpoint that's out of range");+ continue;+ }+ let position = snapshot.anchor_after(point);breakpoints_for_file.breakpoints.push((position,Breakpoint {