[tracker] tracker-priority-queue: Check segments array bounds in peek function
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-priority-queue: Check segments array bounds in peek function
- Date: Thu, 12 Sep 2013 18:04:14 +0000 (UTC)
commit 7c8076e77c32145ce01b691ca95a485510c8c00c
Author: Jonatan PĂ„lsson <jonatan palsson pelagicore com>
Date: Thu Sep 12 10:20:25 2013 +0200
tracker-priority-queue: Check segments array bounds in peek function
Failing to do this will cause indexing outside the bounds of the array
when the priority queue is empty.
src/libtracker-miner/tracker-priority-queue.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-priority-queue.c b/src/libtracker-miner/tracker-priority-queue.c
index 43ae286..c360219 100644
--- a/src/libtracker-miner/tracker-priority-queue.c
+++ b/src/libtracker-miner/tracker-priority-queue.c
@@ -316,7 +316,7 @@ tracker_priority_queue_peek (TrackerPriorityQueue *queue,
{
g_return_val_if_fail (queue != NULL, NULL);
- if (priority_out) {
+ if (priority_out && queue->segments->len > 0) {
PrioritySegment *segment;
segment = &g_array_index (queue->segments, PrioritySegment, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]