diff --git a/ChangeLog b/ChangeLog index 0aa9bbb1c8..fa1e9e31af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ : Graphics: Ensure floodFill sets modified area correctly nRF52: Lower expected BLE XTAL accuracy to 50ppm (can improve BLE stability on some Bangle.js 2) + Emulator: force stack alignment of 'data' variable when accessing ArrayBuffers (fix #2463) 2v21 : nRF52: free up 800b more flash by removing vector table padding Throw Exception when a Promise tries to resolve with another Promise (#2450) diff --git a/src/jsvariterator.c b/src/jsvariterator.c index 6c969357c4..7be01280ed 100644 --- a/src/jsvariterator.c +++ b/src/jsvariterator.c @@ -586,7 +586,7 @@ static JsVarFloat jsvArrayBufferIteratorDataToFloat(JsvArrayBufferIterator *it, JsVar *jsvArrayBufferIteratorGetValue(JsvArrayBufferIterator *it, bool bigEndian) { if (it->type == ARRAYBUFFERVIEW_UNDEFINED) return 0; - char data[8]; + char data[8] __attribute__ ((aligned (4))); jsvArrayBufferIteratorGetValueData(it, data); if (bigEndian) reverseBytes(data, JSV_ARRAYBUFFER_GET_SIZE(it->type)); @@ -612,7 +612,7 @@ JsVar *jsvArrayBufferIteratorGetValueAndRewind(JsvArrayBufferIterator *it) { JsVarInt jsvArrayBufferIteratorGetIntegerValue(JsvArrayBufferIterator *it) { if (it->type == ARRAYBUFFERVIEW_UNDEFINED) return 0; - char data[8]; + char data[8] __attribute__ ((aligned (4))); jsvArrayBufferIteratorGetValueData(it, data); if (JSV_ARRAYBUFFER_IS_FLOAT(it->type)) { return (JsVarInt)jsvArrayBufferIteratorDataToFloat(it, data); @@ -623,7 +623,7 @@ JsVarInt jsvArrayBufferIteratorGetIntegerValue(JsvArrayBufferIterator *it) { JsVarFloat jsvArrayBufferIteratorGetFloatValue(JsvArrayBufferIterator *it) { if (it->type == ARRAYBUFFERVIEW_UNDEFINED) return 0; - char data[8]; + char data[8] __attribute__ ((aligned (4))); jsvArrayBufferIteratorGetValueData(it, data); if (JSV_ARRAYBUFFER_IS_FLOAT(it->type)) { return jsvArrayBufferIteratorDataToFloat(it, data); @@ -653,7 +653,7 @@ static void jsvArrayBufferIteratorFloatToData(char *data, unsigned int dataLen, void jsvArrayBufferIteratorSetIntegerValue(JsvArrayBufferIterator *it, JsVarInt v) { if (it->type == ARRAYBUFFERVIEW_UNDEFINED) return; assert(!it->hasAccessedElement); // we just haven't implemented this case yet - char data[8]; + char data[8] __attribute__ ((aligned (4))); unsigned int i,dataLen = JSV_ARRAYBUFFER_GET_SIZE(it->type); if (JSV_ARRAYBUFFER_IS_FLOAT(it->type)) { @@ -672,7 +672,7 @@ void jsvArrayBufferIteratorSetIntegerValue(JsvArrayBufferIterator *it, JsVarInt void jsvArrayBufferIteratorSetValue(JsvArrayBufferIterator *it, JsVar *value, bool bigEndian) { if (it->type == ARRAYBUFFERVIEW_UNDEFINED) return; assert(!it->hasAccessedElement); // we just haven't implemented this case yet - char data[8]; + char data[8] __attribute__ ((aligned (8))); int i,dataLen = (int)JSV_ARRAYBUFFER_GET_SIZE(it->type); if (JSV_ARRAYBUFFER_IS_FLOAT(it->type)) {