Silent data corruption from unwrap_or_default() on serialization #19

Open
opened 2026-07-25 11:16:37 +00:00 by GKaszewski · 0 comments
Owner

Severity: High

crates/adapters/sqlite/src/channel.rs uses serde_json::to_string(f).unwrap_or_default() for gap_filler serialization. If serialization fails, it silently writes "" to the DB, which will later deserialize as None — quietly losing the channel's gap filler config.

Same file: gap_filler deserialization uses .and_then(|s| serde_json::from_str(s).ok()) which silently swallows corrupt JSON.

Fix: propagate the error or at minimum log a warning when serialization/deserialization fails.

**Severity: High** `crates/adapters/sqlite/src/channel.rs` uses `serde_json::to_string(f).unwrap_or_default()` for gap_filler serialization. If serialization fails, it silently writes `""` to the DB, which will later deserialize as `None` — quietly losing the channel's gap filler config. Same file: gap_filler deserialization uses `.and_then(|s| serde_json::from_str(s).ok())` which silently swallows corrupt JSON. Fix: propagate the error or at minimum log a warning when serialization/deserialization fails.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GKaszewski/k-tv#19