[gnome-system-monitor/abderrahim/outofbounds] load-graph: fix out-of-bounds error
- From: Abderrahim Kitouni <akitouni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor/abderrahim/outofbounds] load-graph: fix out-of-bounds error
- Date: Sat, 13 Feb 2021 15:48:58 +0000 (UTC)
commit 5076dae1bfdc3e127b3da6e1556e0e6db5168375
Author: Abderrahim Kitouni <akitouni gnome org>
Date: Sat Feb 13 16:48:47 2021 +0100
load-graph: fix out-of-bounds error
src/load-graph.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 3285d111..5282ce23 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -628,7 +628,7 @@ net_scale (LoadGraph *graph, guint64 din, guint64 dout)
new_max = dmax;
else
new_max = *std::max_element(&graph->net.values[0],
- &graph->net.values[graph->num_points]);
+ &graph->net.values[graph->num_points - 1]);
//
// Round network maximum
@@ -792,8 +792,8 @@ load_graph_update_data (LoadGraph *graph)
{
// Rotate data one element down.
std::rotate(&graph->data[0],
- &graph->data[graph->num_points - 1],
- &graph->data[graph->num_points]);
+ &graph->data[graph->num_points - 2],
+ &graph->data[graph->num_points - 1]);
// Update rotation counter.
graph->latest = (graph->latest + 1) % graph->num_points;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]