Skip to content

Commit 4564654

Browse files
committedJan 2, 2015
bounds checking for one case in dataview
probably there are other places where this is needed, but this one had a FIXME comment, and it helps diagnose problems we are seeing with messages apparently being broken into frames/fragments
1 parent 9f44e3f commit 4564654

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎src/endian_aware_dataview.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@
102102
this.buffer, this.offset + offset, this.buffer.byteLength);
103103
},
104104
view: function(new_offset, new_length) {
105-
// FIXME Needs bounds checking
105+
var ofs = this.offset + new_offset;
106+
if(ofs + new_length > this.buffer.byteLength)
107+
throw new Error("Rserve.my_ArrayBufferView.view: bounds error: sgize: " +
108+
this.buffer.byteLength + " offset: " + ofs + " length: " + new_length);
106109
return Rserve.my_ArrayBufferView(
107-
this.buffer, this.offset + new_offset, new_length);
110+
this.buffer, ofs, new_length);
108111
}
109112
};
110113
};
111114

112115
})(this);
113-

0 commit comments

Comments
 (0)