Skip to content

Commit f0cfaed

Browse files
committed
Remove canary
Destructors are sound now, so this is no longer necessary
1 parent 4f51838 commit f0cfaed

2 files changed

Lines changed: 0 additions & 15 deletions

File tree

src/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ mod url;
100100
mod util;
101101
pub mod types;
102102

103-
const CANARY: u32 = 0xdeadbeef;
104103
const TYPEINFO_QUERY: &'static str = "t";
105104

106105
/// A type alias of the result returned by many methods.
@@ -398,7 +397,6 @@ struct InnerConnection {
398397
parameters: HashMap<String, String>,
399398
next_stmt_id: u32,
400399
trans_depth: u32,
401-
canary: u32,
402400
desynchronized: bool,
403401
finished: bool,
404402
}
@@ -433,7 +431,6 @@ impl InnerConnection {
433431
desynchronized: false,
434432
finished: false,
435433
trans_depth: 0,
436-
canary: CANARY,
437434
};
438435

439436
options.push(("client_encoding".to_owned(), "UTF8".to_owned()));
@@ -797,10 +794,6 @@ impl InnerConnection {
797794
self.desynchronized
798795
}
799796

800-
fn canary(&self) -> u32 {
801-
self.canary
802-
}
803-
804797
fn wait_for_ready(&mut self) -> Result<()> {
805798
match try!(self.read_message()) {
806799
ReadyForQuery { .. } => Ok(()),
@@ -840,7 +833,6 @@ impl InnerConnection {
840833

841834
fn finish_inner(&mut self) -> Result<()> {
842835
check_desync!(self);
843-
self.canary = 0;
844836
try!(self.write_messages(&[Terminate]));
845837
Ok(())
846838
}
@@ -1142,10 +1134,6 @@ impl Connection {
11421134
conn.finish_inner()
11431135
}
11441136

1145-
fn canary(&self) -> u32 {
1146-
self.conn.borrow().canary()
1147-
}
1148-
11491137
fn write_messages(&self, messages: &[FrontendMessage]) -> IoResult<()> {
11501138
self.conn.borrow_mut().write_messages(messages)
11511139
}

src/macros.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ macro_rules! try_desync {
1212

1313
macro_rules! check_desync {
1414
($e:expr) => ({
15-
if $e.canary() != CANARY {
16-
panic!("Connection use after free. See mozilla/rust#13246.");
17-
}
1815
if $e.is_desynchronized() {
1916
return Err(::Error::StreamDesynchronized);
2017
}

0 commit comments

Comments
 (0)