mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 12:51:36 +08:00
replay: fix potential invalid memory access
_subscriptions is a vector that is resized when needed. However there could still be references to elements in the vector when the resize happens. These references then become invalid. Using a vector of pointers fixes that.
This commit is contained in:
@@ -58,9 +58,9 @@ namespace px4
|
||||
class Replay : public ModuleBase<Replay>
|
||||
{
|
||||
public:
|
||||
Replay() {}
|
||||
Replay() = default;
|
||||
|
||||
virtual ~Replay() {}
|
||||
virtual ~Replay();
|
||||
|
||||
/** @see ModuleBase */
|
||||
static int task_spawn(int argc, char *argv[]);
|
||||
@@ -205,7 +205,7 @@ protected:
|
||||
*/
|
||||
bool nextDataMessage(std::ifstream &file, Subscription &subscription, int msg_id);
|
||||
|
||||
std::vector<Subscription> _subscriptions;
|
||||
std::vector<Subscription *> _subscriptions;
|
||||
std::vector<uint8_t> _read_buffer;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user