mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Fix crash comparing empty file against nonempty file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19782 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9c32d3b798
commit
da7e70e058
@ -93,7 +93,8 @@ static bool CompareNumbers(char *&F1P, char *&F2P, char *F1End, char *F2End,
|
||||
// with a number. Because of this, if needed, we pad the file so that it starts
|
||||
// and ends with a null character.
|
||||
static void PadFileIfNeeded(char *&FileStart, char *&FileEnd, char *&FP) {
|
||||
if (isNumberChar(FileStart[0]) || isNumberChar(FileEnd[-1])) {
|
||||
if (FileStart-FileEnd < 2 ||
|
||||
isNumberChar(FileStart[0]) || isNumberChar(FileEnd[-1])) {
|
||||
unsigned FileLen = FileEnd-FileStart;
|
||||
char *NewFile = new char[FileLen+2];
|
||||
NewFile[0] = 0; // Add null padding
|
||||
|
Loading…
Reference in New Issue
Block a user