Hi,
This patch merges the D front-end implementation with upstream dmd,
fixing a heap-buffer-overflow in checkModFileAlias. The code wrongly
assumed memcmp did not read past the mismatch.
Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32,
committed to mainline, and backported to the gcc-10 and gcc-9 release
branches.
Regards,
Iain.
---
gcc/d/ChangeLog:
PR d/99337
* dmd/MERGE: Merge upstream dmd a3c9bf422.
---
gcc/d/dmd/MERGE | 2 +-
gcc/d/dmd/dmodule.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 690fe407278..78b454c1c64 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-7132b3537dc27cb353da75798082ffe7ea3d69a6
+a3c9bf422e7ff54d45846b8c577ee82da4234db1
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/dmodule.c b/gcc/d/dmd/dmodule.c
index a2b01f534eb..ed01858f06b 100644
--- a/gcc/d/dmd/dmodule.c
+++ b/gcc/d/dmd/dmodule.c
@@ -195,7 +195,7 @@ static void checkModFileAlias(OutBuffer *buf, OutBuffer
*dotmods,
const char *m = (*ms)[j];
const char *q = strchr(m, '=');
assert(q);
- if (dotmods->length() <= (size_t)(q - m) &&
memcmp(dotmods->peekChars(), m, q - m) == 0)
+ if (dotmods->length() == (size_t)(q - m) &&
memcmp(dotmods->peekChars(), m, q - m) == 0)
{
buf->reset();
size_t qlen = strlen(q + 1);
--
2.27.0