diff options
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | src/cv2pdb.cpp | 10 |
2 files changed, 11 insertions, 3 deletions
@@ -80,3 +80,7 @@ Version history * dmd-patch needed for long/ulong support (http://d.puremagic.com/issues/show_bug.cgi?id=3373)
* experimental hack to add lexical scope to local variables (dmd patch in
http://d.puremagic.com/issues/show_bug.cgi?id=3657 needed)
+
+Version 0.12
+
+ * added patch to convert binaries produced by Metroworks CodeWarrior
diff --git a/src/cv2pdb.cpp b/src/cv2pdb.cpp index 00ff969..a503eda 100644 --- a/src/cv2pdb.cpp +++ b/src/cv2pdb.cpp @@ -2037,8 +2037,12 @@ bool CV2PDB::createSrcLineBitmap() for (int s = 0; s < segMap->cSeg; s++)
{
- srcLineStart[s] = new char[segMapDesc[s].cbSeg];
- memset(srcLineStart[s], 0, segMapDesc[s].cbSeg);
+ // cbSeg=-1 found in binary created by Metroworks CodeWarrior, so avoid new char[(size_t)-1]
+ if (segMapDesc[s].cbSeg <= LONG_MAX)
+ {
+ srcLineStart[s] = new char[segMapDesc[s].cbSeg];
+ memset(srcLineStart[s], 0, segMapDesc[s].cbSeg);
+ }
}
for (int m = 0; m < countEntries; m++)
@@ -2105,7 +2109,7 @@ int CV2PDB::getNextSrcLine(int seg, unsigned int off) return -1; off -= segMapDesc[s].offset;
- if (off < 0 || off >= segMapDesc[s].cbSeg)
+ if (off < 0 || off >= segMapDesc[s].cbSeg || off > LONG_MAX)
return 0;
for (off++; off < segMapDesc[s].cbSeg; off++)
|