mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
OP-1493 Fix stack overflow problem when the firmware code size is large
This commit is contained in:
parent
ef341c8a06
commit
61a58eeba9
@ -1003,7 +1003,7 @@ quint32 DFUObject::CRCFromQBArray(QByteArray array, quint32 Size)
|
||||
quint32 pad = Size - array.length();
|
||||
|
||||
array.append(QByteArray(pad, 255));
|
||||
quint32 t[Size / 4];
|
||||
quint32 *t = new quint32[Size / 4];
|
||||
for (int x = 0; x < array.length() / 4; x++) {
|
||||
quint32 aux = 0;
|
||||
aux = (char)array[x * 4 + 3] & 0xFF;
|
||||
@ -1015,7 +1015,11 @@ quint32 DFUObject::CRCFromQBArray(QByteArray array, quint32 Size)
|
||||
aux += (char)array[x * 4 + 0] & 0xFF;
|
||||
t[x] = aux;
|
||||
}
|
||||
return DFUObject::CRC32WideFast(0xFFFFFFFF, Size / 4, (quint32 *)t);
|
||||
quint32 ret = DFUObject::CRC32WideFast(0xFFFFFFFF, Size / 4, t);
|
||||
|
||||
delete[] t;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user