mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 19:37:15 +00:00
Bug 1414623 - P1: Make state_callback synchronous. r=kinetik
MozReview-Commit-ID: EvgJiPQAYO6 --HG-- extra : rebase_source : 24ed86b7183bb009f9f3ebfb5a1fe757a3428da4
This commit is contained in:
parent
58b09d8e57
commit
db190864d1
@ -209,7 +209,8 @@ pub enum ServerMessage {
|
||||
StreamSetPanning(usize, f32),
|
||||
StreamGetCurrentDevice(usize),
|
||||
|
||||
StreamDataCallback(isize)
|
||||
StreamDataCallback(isize),
|
||||
StreamStateCallback
|
||||
}
|
||||
|
||||
// Server -> Client messages.
|
||||
|
@ -83,6 +83,11 @@ fn stream_thread(
|
||||
set_in_callback(true);
|
||||
state_cb(ptr::null_mut(), user_ptr as *mut _, state);
|
||||
set_in_callback(false);
|
||||
let r = conn.send(ServerMessage::StreamStateCallback);
|
||||
if r.is_err() {
|
||||
debug!("stream_thread: Failed to send StreamStateCallback: {:?}", r);
|
||||
return;
|
||||
}
|
||||
},
|
||||
m => {
|
||||
info!("Unexpected ClientMessage: {:?}", m);
|
||||
|
@ -110,7 +110,7 @@ impl cubeb::StreamCallback for Callback {
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
debug!("Unexpected message {:?} during callback", r);
|
||||
debug!("Unexpected message {:?} during data_callback", r);
|
||||
-1
|
||||
},
|
||||
}
|
||||
@ -131,6 +131,18 @@ impl cubeb::StreamCallback for Callback {
|
||||
if r.is_err() {
|
||||
debug!("state_callback: Failed to send to client - got={:?}", r);
|
||||
}
|
||||
|
||||
// Bug 1414623 - We need to block on an ACK from the client
|
||||
// side to make state_callback synchronous. If not, then there
|
||||
// exists a race on cubeb_stream_stop()/cubeb_stream_destroy()
|
||||
// in Gecko that results in a UAF.
|
||||
let r = self.connection.receive();
|
||||
match r {
|
||||
Ok(ServerMessage::StreamStateCallback) => {},
|
||||
_ => {
|
||||
debug!("Unexpected message {:?} during state_callback", r);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user