summaryrefslogtreecommitdiff
path: root/src/lib/rrdFile.js
diff options
context:
space:
mode:
authorIgor Sfiligoi <isfiligoi@ucsd.edu>2013-03-23 16:12:34 +0000
committerIgor Sfiligoi <isfiligoi@ucsd.edu>2013-03-23 16:12:34 +0000
commit82592941fbb012a0581e63f3c22ceb5ae38a1026 (patch)
treecae3048261aefa669e0e4e198477838b41701f99 /src/lib/rrdFile.js
parentccde18044f9a13d91d367550d72b61a03e32129a (diff)
Better support for error in Chrome
Diffstat (limited to 'src/lib/rrdFile.js')
-rw-r--r--src/lib/rrdFile.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/rrdFile.js b/src/lib/rrdFile.js
index 0f7c80d..81f7731 100644
--- a/src/lib/rrdFile.js
+++ b/src/lib/rrdFile.js
@@ -204,6 +204,8 @@ function RRDHeader(rrd_data) {
// Internal, used for initialization
RRDHeader.prototype.validate_rrd = function() {
+ if (this.rrd_data.getLength()<1) throw new InvalidRRD("Empty file.");
+ if (this.rrd_data.getLength()<16) throw new InvalidRRD("File too short.");
if (this.rrd_data.getCStringAt(0,4)!=="RRD") throw new InvalidRRD("Wrong magic id.");
this.rrd_version=this.rrd_data.getCStringAt(4,5);