summaryrefslogtreecommitdiff
path: root/src/lib/rrdFile.js
diff options
context:
space:
mode:
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);