diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/LineMarker.cxx | 15 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 2 | 
2 files changed, 13 insertions, 4 deletions
| diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index 99e54072f..faf265475 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -5,6 +5,7 @@  // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>  // The License.txt file describes the conditions under which this software may be distributed. +#include <string.h>  #include <stdlib.h>  #include "Platform.h" @@ -151,9 +152,17 @@ void LineMarker::RefreshColourPalette(Palette &pal, bool want) {  }  void LineMarker::SetXPM(const char *textForm) { -	delete pxpm; -	pxpm = new XPM(textForm); -	markType = SC_MARK_PIXMAP; +	// Test done is two parts to avoid possibility of overstepping the memory +	// if memcmp implemented strangely. Must be 4 bytes at least at destination. +	if ((0 == memcmp(textForm, "/* X", 4)) && (0 == memcmp(textForm, "/* XPM */", 9))) { +		// It is in text form +		delete pxpm; +		pxpm = new XPM(textForm); +		markType = SC_MARK_PIXMAP; +	} else { +		// It is really in line form +		SetXPM(reinterpret_cast<const char * const *>(textForm)); +	}  }  void LineMarker::SetXPM(const char * const *linesForm) { diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 1c44b0bd6..620513b4f 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -510,7 +510,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  		return ac.dropRestOfWord;  	case SCI_REGISTERIMAGE: -		ac.lb.SetTypeXpm(wParam, reinterpret_cast<const char **>(lParam)); +		ac.lb.SetTypeXpm(wParam, reinterpret_cast<const char *>(lParam));  		break;  	case SCI_CALLTIPSHOW: { | 
