mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-11-04 06:57:38 +00:00
emv: fix false -Wstringop-overflow in AID list rule with AVX2
Building the client with -march=x86-64-v3 (the CentOS/RHEL 10 baseline) fails with gcc 14: src/emv/emvcore.c:211:24: error: writing 32 bytes into a region of size 22 [-Werror=stringop-overflow=] gcc vectorizes the dash fill loop in aidlist_rule() into 32-byte stores and loses the pos + 2 < dstlen bound. The bound was correct. Compute the dash count with the same limit and fill it with memset, so there is no vectorized loop store to mis-size. Output is unchanged. Reported in #3671. Co-Authored-By: Grok Bot <noreply@users.noreply.github.com>
This commit is contained in:
1 parent
6ce4ec49c1
commit
56efde54f5
2 files changed
+8
-2
No files matched your search
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Fixed client build with `-march=x86-64-v3` (CentOS/RHEL 10 default) - false `-Wstringop-overflow` in the EMV AID list table (@r3wretrhy)
|
||||
- Changed `hf seos info` - now prints UID, ATQA, SAK, ATS, MIFARE Classic emulation, which SEOS AIDs answer and the known AIDs found (@antoniovazquezblanco)
|
||||
- Fixed `hf seos managekeys -p` - key table columns stay aligned for slots 10 and up (@antoniovazquezblanco)
|
||||
- Fixed `aidlist.json` - uppercased the SEOS, TeslaDAP and LA Tap AIDs (@antoniovazquezblanco)
|
||||
|
||||
@@ -207,9 +207,14 @@ static void aidlist_rule(char *dst, size_t dstlen, size_t w_aid, size_t w_prio,
|
||||
|
||||
dst[pos++] = '+';
|
||||
for (size_t c = 0; c < 3; c++) {
|
||||
for (size_t i = 0; (i < widths[c] + 2) && (pos + 2 < dstlen); i++) {
|
||||
dst[pos++] = '-';
|
||||
// memset, not a byte loop: gcc's AVX2 vectorized loop trips -Wstringop-overflow
|
||||
size_t n = widths[c] + 2;
|
||||
size_t room = (pos + 2 < dstlen) ? dstlen - pos - 2 : 0;
|
||||
if (n > room) {
|
||||
n = room;
|
||||
}
|
||||
memset(dst + pos, '-', n);
|
||||
pos += n;
|
||||
if (pos + 1 < dstlen) {
|
||||
dst[pos++] = '+';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user