Skip to content

Commit

Permalink
added a check for buffer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkisquared committed Dec 30, 2015
1 parent 20edf21 commit 773a15d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/script/dom/websocket.rs
Expand Up @@ -299,7 +299,11 @@ impl WebSocket {
let chan = global.r().networking_task_source();
let address = Trusted::new(self, chan.clone());

self.buffered_amount.set(self.buffered_amount.get() + data_byte_len);
match data_byte_len.checked_add(self.buffered_amount.get()) {
None => return Ok(false),
Some(new_amount) => self.buffered_amount.set(new_amount)
};
// self.buffered_amount.set(self.buffered_amount.get() + data_byte_len);

if return_after_buffer {
return Ok(false);
Expand Down

0 comments on commit 773a15d

Please sign in to comment.