diff options
| author | Neil <nyamatongwe@gmail.com> | 2019-06-04 13:13:51 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2019-06-04 13:13:51 +1000 |
| commit | 1522a079efe1d49e384f52271fdd7e91246ed4bb (patch) | |
| tree | d18acb0625cb38c8393c086580c062b0c170af10 | |
| parent | 0fa2db7b2f84c31c0439d8481fe49be323f6a96e (diff) | |
| download | scintilla-mirror-1522a079efe1d49e384f52271fdd7e91246ed4bb.tar.gz | |
Backport: Bug [#2104]. Use '%.0f' and casts to double to fix printf format string bugs.
This will extend valid maximum position from 31-bits to 53-bits which is ample.
Backport of changeset 7546:f3b2a4dba48c.
| -rw-r--r-- | src/CellBuffer.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 4b4a427d9..d678eb755 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -558,8 +558,10 @@ void CellBuffer::GetCharRange(char *buffer, Sci::Position position, Sci::Positio if (position < 0) return; if ((position + lengthRetrieve) > substance.Length()) { - Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", position, - lengthRetrieve, substance.Length()); + Platform::DebugPrintf("Bad GetCharRange %.0f for %.0f of %.0f\n", + static_cast<double>(position), + static_cast<double>(lengthRetrieve), + static_cast<double>(substance.Length())); return; } substance.GetRange(buffer, position, lengthRetrieve); @@ -579,8 +581,10 @@ void CellBuffer::GetStyleRange(unsigned char *buffer, Sci::Position position, Sc return; } if ((position + lengthRetrieve) > style.Length()) { - Platform::DebugPrintf("Bad GetStyleRange %d for %d of %d\n", position, - lengthRetrieve, style.Length()); + Platform::DebugPrintf("Bad GetStyleRange %.0f for %.0f of %.0f\n", + static_cast<double>(position), + static_cast<double>(lengthRetrieve), + static_cast<double>(style.Length())); return; } style.GetRange(reinterpret_cast<char *>(buffer), position, lengthRetrieve); |
