Skip to content

Commit

Permalink
ubsan: fix few format string bugs
Browse files Browse the repository at this point in the history
This fixes just a few of the warnings.
Ubsan is not completely clean yet,
but these somehow pop up while I was
fixing other sanitizers.

Depends on D107983.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D107984
  • Loading branch information
dvyukov committed Aug 13, 2021
1 parent c90bf3f commit 7371085
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler-rt/lib/ubsan/ubsan_diag.cpp
Expand Up @@ -157,7 +157,7 @@ static void RenderLocation(InternalScopedString *Buffer, Location Loc) {
return;
}
case Location::LK_Memory:
Buffer->append("%p", Loc.getMemoryLocation());
Buffer->append("%p", reinterpret_cast<void *>(Loc.getMemoryLocation()));
return;
case Location::LK_Symbolized: {
const AddressInfo &Info = Loc.getSymbolizedStack()->info;
Expand All @@ -169,7 +169,7 @@ static void RenderLocation(InternalScopedString *Buffer, Location Loc) {
RenderModuleLocation(Buffer, Info.module, Info.module_offset,
Info.module_arch, common_flags()->strip_path_prefix);
else
Buffer->append("%p", Info.address);
Buffer->append("%p", reinterpret_cast<void *>(Info.address));
return;
}
case Location::LK_Null:
Expand Down Expand Up @@ -286,7 +286,7 @@ static void PrintMemorySnippet(const Decorator &Decor, MemoryLocation Loc,
Buffer.append("\n");

// Emit highlights.
Buffer.append(Decor.Highlight());
Buffer.append("%s", Decor.Highlight());
Range *InRange = upperBound(Min, Ranges, NumRanges);
for (uptr P = Min; P != Max; ++P) {
char Pad = ' ', Byte = ' ';
Expand Down Expand Up @@ -355,7 +355,7 @@ Diag::~Diag() {
Buffer.clear();
}

Buffer.append(Decor.Bold());
Buffer.append("%s", Decor.Bold());
RenderLocation(&Buffer, Loc);
Buffer.append(":");

Expand Down

0 comments on commit 7371085

Please sign in to comment.