diff options
author | Igor Sfiligoi <isfiligoi@ucsd.edu> | 2013-03-23 16:12:34 +0000 |
---|---|---|
committer | Igor Sfiligoi <isfiligoi@ucsd.edu> | 2013-03-23 16:12:34 +0000 |
commit | 82592941fbb012a0581e63f3c22ceb5ae38a1026 (patch) | |
tree | cae3048261aefa669e0e4e198477838b41701f99 /src/lib | |
parent | ccde18044f9a13d91d367550d72b61a03e32129a (diff) |
Better support for error in Chrome
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/rrdFile.js | 2 |
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);
|