From bb0876fa65e707042351b4aa5de237b9d5c1c253 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 25 May 2017 07:59:31 -0400 Subject: [PATCH] 2017-05-24 Fred Gleason * Fixed a bug in 'ripcd/livewiremcastgpio.cpp' that caused a segfault when send a LiveWire multicast GPIO event that existed in the driver configuration but was beyond the number of active GPIOS set. --- ChangeLog | 4 ++++ ripcd/livewire_mcastgpio.cpp | 16 +++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67a0aafe..56131578 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15806,3 +15806,7 @@ code at program shutdown. 2017-05-23 Fred Gleason * Incremented the package version to 2.15.3int07. +2017-05-24 Fred Gleason + * Fixed a bug in 'ripcd/livewiremcastgpio.cpp' that caused a segfault + when send a LiveWire multicast GPIO event that existed in the driver + configuration but was beyond the number of active GPIOS set. diff --git a/ripcd/livewire_mcastgpio.cpp b/ripcd/livewire_mcastgpio.cpp index 9f098b45..8f82c7c9 100644 --- a/ripcd/livewire_mcastgpio.cpp +++ b/ripcd/livewire_mcastgpio.cpp @@ -143,9 +143,11 @@ LiveWireMcastGpio::LiveWireMcastGpio(RDMatrix *matrix,QObject *parent) "order by SLOT"; q=new RDSqlQuery(sql); while(q->next()) { - livewire_source_numbers[q->value(0).toInt()]=q->value(1).toInt(); - livewire_surface_addresses[q->value(0).toInt()]= - QHostAddress(q->value(2).toString()); + if(q->value(0).toInt()<((int)livewire_gpios/RD_LIVEWIRE_GPIO_BUNDLE_SIZE)) { + livewire_source_numbers[q->value(0).toInt()]=q->value(1).toInt(); + livewire_surface_addresses[q->value(0).toInt()]= + QHostAddress(q->value(2).toString()); + } } delete q; } @@ -231,14 +233,6 @@ void LiveWireMcastGpio::processCommand(RDMacro *cmd) } ProcessGpoIn(livewire_source_numbers[slot],line,cmd->arg(3).toInt()); livewire_gpo_in_states[cmd->arg(2).toInt()-1]=cmd->arg(3).toInt(); - /* - emit gpiChanged(livewire_matrix,cmd->arg(2).toInt()-1, - cmd->arg(3).toInt()); - if(cmd->arg(4).toInt()>0) { - livewire_gpi_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); - } - */ } if(cmd->arg(1).toString().lower()=="o") { slot=(cmd->arg(2).toInt()-1)/5;