You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2023/10/06 12:43:26 UTC
[mynewt-core] 02/02: encoding/base64: Fix compilation warning with ARM GCC 13
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit a87c17d717249b104e89367f7bf0ea44f2ea90d1
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Fri Oct 6 08:58:33 2023 +0200
encoding/base64: Fix compilation warning with ARM GCC 13
Error: repos/apache-mynewt-core/encoding/base64/src/base64.c:
In function 'base64_decoder_go':
repos/apache-mynewt-core/encoding/base64/src/base64.c:261:9: error:
'memcpy' specified size between 2147483653 and 4294967295 exceeds
maximum object size 2147483647 [-Werror=stringop-overflow=]
261 | memcpy(&dec->buf[dec->buf_len], &dec->src[src_off], read_len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
---
encoding/base64/src/base64.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/encoding/base64/src/base64.c b/encoding/base64/src/base64.c
index 51771212b..83cc7d317 100644
--- a/encoding/base64/src/base64.c
+++ b/encoding/base64/src/base64.c
@@ -42,6 +42,7 @@
#include <string.h>
#include <limits.h>
#include <stdio.h>
+#include <assert.h>
#include <os/mynewt.h>
#include <base64/base64.h>
@@ -233,6 +234,7 @@ base64_decoder_go(struct base64_decoder *dec)
}
/* Account for possibility of partial token from previous call. */
+ assert(dec->buf_len < 4);
read_len = 4 - dec->buf_len;
/* Detect invalid input. */