You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A couple of times in dump.cpp (and maybe elsewhere; I didn't check further) you cast a pointer to an int.
void *memAddress = (void *)((int)at + c);
at = (void *)((int)at + 1);
This is dangerous, as, with some combination of hardware and software, that can result in a 4 or 8 byte pointer being cast to a 2 or 4 byte integer.
I suggest using size_t instead as
It's unsigned
It's guaranteed to be large enough to store a pointer
Examples where there are problems:
EpoxyDuino, where sizeof(int) is 4 and sizeof(void*) is 8.
I expect similar with Arduino Mega with 256K Flash; I expect 4 byte pointer and 2 byte integer, but I haven't checked this.
On other occasions, you cast pointers as unsigned long e.g. out.print((unsigned long)at,HEX);. consider changing these to size_t also, to save space on typical Arduinos (Uno & Nano, anyway).
The text was updated successfully, but these errors were encountered:
A couple of times in dump.cpp (and maybe elsewhere; I didn't check further) you cast a pointer to an
int
.This is dangerous, as, with some combination of hardware and software, that can result in a 4 or 8 byte pointer being cast to a 2 or 4 byte integer.
I suggest using
size_t
instead asExamples where there are problems:
sizeof(int)
is 4 andsizeof(void*)
is 8.On other occasions, you cast pointers as
unsigned long
e.g.out.print((unsigned long)at,HEX);
. consider changing these tosize_t
also, to save space on typical Arduinos (Uno & Nano, anyway).The text was updated successfully, but these errors were encountered: