summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsagitario <sagitario@fc51e93f-b9fe-4711-8d8d-3ae870c5f7d8>2010-02-11 22:40:10 (GMT)
committersagitario <sagitario@fc51e93f-b9fe-4711-8d8d-3ae870c5f7d8>2010-02-11 22:40:10 (GMT)
commitca2d69f4a43f7209113ceee6773bd04bbe6bd317 (patch)
tree757568904d2f910365d9f92766b90f68ce31e4ba /src
parent68e0196f31f8d6fef0d7ccaa21c0f33d5fa5504e (diff)
downloadcv2pdb-ca2d69f4a43f7209113ceee6773bd04bbe6bd317.zip
cv2pdb-ca2d69f4a43f7209113ceee6773bd04bbe6bd317.tar.gz
cv2pdb-ca2d69f4a43f7209113ceee6773bd04bbe6bd317.tar.bz2
added patch to convert binaries produced by Metroworks CodeWarrior
Diffstat (limited to 'src')
-rw-r--r--src/cv2pdb.cpp10
1 files changed, 7 insertions, 3 deletions
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++)