msquic
msquic copied to clipboard
Build fails on Ubuntu 23.04 w/gcc 12.3.0
Describe the bug
Building @ HEAD on Ubuntu 23.04 w/gcc 12.3.0 fails with:
/home/jwhited/msquic/src/inc/msquichelper.h:268:28: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
268 | HexString[i*2 + 1] = HEX_TO_CHAR(Buffer[i] & 0xf);
Ignoring stringop-overflow enables the build to succeed:
jwhited@i5-12400-2:~/msquic/artifacts/bin/linux/x64_Release_openssl3$ git diff
diff --git a/src/inc/msquichelper.h b/src/inc/msquichelper.h
index 232ea616..8579961e 100644
--- a/src/inc/msquichelper.h
+++ b/src/inc/msquichelper.h
@@ -265,6 +265,7 @@ EncodeHexBuffer(
#define HEX_TO_CHAR(x) ((x) > 9 ? ('a' + ((x) - 10)) : '0' + (x))
for (uint8_t i = 0; i < BufferLen; i++) {
HexString[i*2] = HEX_TO_CHAR(Buffer[i] >> 4);
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
HexString[i*2 + 1] = HEX_TO_CHAR(Buffer[i] & 0xf);
}
}
The same commit of msquic builds on Ubuntu 22.04 without issue last I checked (GCC version not at hand), so appears to be due to a toolchain change. Not sure if it's a false positive or legitimate issue, there are reports of stringop-overflow false positives in newer versions of GCC.
Affected OS
- [ ] Windows
- [X] Linux
- [ ] macOS
- [ ] Other (specify below)
Additional OS information
Ubuntu 23.04 gcc 12.3.0
MsQuic version
main
Steps taken to reproduce bug
./scripts/build.ps1 -Config Release -Clean- Observe build failure
Expected behavior
The build succeeds
Actual outcome
The build fails due to:
/home/jwhited/msquic/src/inc/msquichelper.h:268:28: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
268 | HexString[i*2 + 1] = HEX_TO_CHAR(Buffer[i] & 0xf);
Additional details
No response
I'm pretty sure this is a false positive. Mind making a PR to ignore this? Is this OS version available in GitHub to add automation?
Reproduced with GCC 13.2.0 on Red Hat 7.9
I'm pretty sure this is a false positive. Mind making a PR to ignore this? Is this OS version available in GitHub to add automation?
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
Doesn't look like it's available yet. ubuntu-latest is ubuntu-22.04 at time of writing.
https://github.com/microsoft/msquic/pull/3949