mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1322463 - Replace snprintf/vsnprintf by SprintfLiteral/VsprintfLiteral for what clang plugin reports on Windows. r=Ehsan
MozReview-Commit-ID: 2bFcM53uEPb --HG-- extra : rebase_source : 4e69d3f3f95c18bcbf731a17cb98fa456ddaa118
This commit is contained in:
parent
3b21f2993f
commit
19a9104684
@ -14,6 +14,7 @@
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "jswin.h"
|
||||
#include <psapi.h>
|
||||
|
||||
@ -853,7 +854,7 @@ ProtectPages(void* p, size_t size)
|
||||
#if defined(XP_WIN)
|
||||
DWORD oldProtect;
|
||||
if (!VirtualProtect(p, size, PAGE_NOACCESS, &oldProtect)) {
|
||||
snprintf(sCrashReason, sizeof(sCrashReason),
|
||||
SprintfLiteral(sCrashReason,
|
||||
"MOZ_CRASH(VirtualProtect(PAGE_NOACCESS) failed! Error code: %u)", GetLastError());
|
||||
MOZ_CRASH_ANNOTATE(sCrashReason);
|
||||
MOZ_REALLY_CRASH();
|
||||
@ -874,7 +875,7 @@ MakePagesReadOnly(void* p, size_t size)
|
||||
#if defined(XP_WIN)
|
||||
DWORD oldProtect;
|
||||
if (!VirtualProtect(p, size, PAGE_READONLY, &oldProtect)) {
|
||||
snprintf(sCrashReason, sizeof(sCrashReason),
|
||||
SprintfLiteral(sCrashReason,
|
||||
"MOZ_CRASH(VirtualProtect(PAGE_READONLY) failed! Error code: %u)", GetLastError());
|
||||
MOZ_CRASH_ANNOTATE(sCrashReason);
|
||||
MOZ_REALLY_CRASH();
|
||||
@ -895,7 +896,7 @@ UnprotectPages(void* p, size_t size)
|
||||
#if defined(XP_WIN)
|
||||
DWORD oldProtect;
|
||||
if (!VirtualProtect(p, size, PAGE_READWRITE, &oldProtect)) {
|
||||
snprintf(sCrashReason, sizeof(sCrashReason),
|
||||
SprintfLiteral(sCrashReason,
|
||||
"MOZ_CRASH(VirtualProtect(PAGE_READWRITE) failed! Error code: %u)", GetLastError());
|
||||
MOZ_CRASH_ANNOTATE(sCrashReason);
|
||||
MOZ_REALLY_CRASH();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#include "nsWindowsDllInterceptor.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#include "nsWindowsHelpers.h"
|
||||
@ -260,8 +261,7 @@ printf_stderr(const char *fmt, ...)
|
||||
char buf[2048];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
VsprintfLiteral(buf, fmt, args);
|
||||
va_end(args);
|
||||
OutputDebugStringA(buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user