summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorMarkos Fountoulakis <44345837+mfundul@users.noreply.github.com>2020-09-09 17:03:25 +0300
committerGitHub <noreply@github.com>2020-09-09 17:03:25 +0300
commit3e0661a2afebbe3b40e51740abe468de23e11e41 (patch)
tree98394519cb412fe554c173801467b385420e3cfd /web
parenta195025ec69bef0ebfaf0e979b41d8a9a0f4097c (diff)
Fix buffer overflow in rrdr structure when metric timestamps are out of order. (#9903)
Diffstat (limited to 'web')
-rw-r--r--web/api/queries/query.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/web/api/queries/query.c b/web/api/queries/query.c
index b0eb826d6b..68b3525715 100644
--- a/web/api/queries/query.c
+++ b/web/api/queries/query.c
@@ -573,6 +573,12 @@ static inline void do_dimension_fixedstep(
#endif
db_now = now; // this is needed to set db_now in case the next_metric implementation does not set it
storage_number n = rd->state->query_ops.next_metric(&handle, &db_now);
+ if(unlikely(db_now > before_wanted)) {
+#ifdef NETDATA_INTERNAL_CHECKS
+ r->internal.log = "stopped, because attempted to access the db after 'wanted before'";
+#endif
+ break;
+ }
for ( ; now <= db_now ; now += dt) {
calculated_number value = NAN;
if(likely(now >= db_now && does_storage_number_exist(n))) {