@@ -66,17 +66,16 @@ void NORETURN reportInvalidFlag(const char *FlagType, const char *Value) {
66
66
67
67
// The checksum of a chunk header is invalid. This could be caused by an
68
68
// {over,under}write of the header, a pointer that is not an actual chunk.
69
- void NORETURN reportHeaderCorruption (void *Header, void *Ptr) {
69
+ void NORETURN reportHeaderCorruption (void *Header, const void *Ptr) {
70
70
ScopedErrorReport Report;
71
71
Report.append (" corrupted chunk header at address %p" , Ptr);
72
72
if (*static_cast <Chunk::PackedHeader *>(Header) == 0U ) {
73
73
// Header all zero, which could indicate that this might be a pointer that
74
74
// has been double freed but the memory has been released to the kernel.
75
75
Report.append (" : chunk header is zero and might indicate memory corruption "
76
- " or a double free\n " ,
77
- Ptr);
76
+ " or a double free\n " );
78
77
} else {
79
- Report.append (" : most likely due to memory corruption\n " , Ptr );
78
+ Report.append (" : most likely due to memory corruption\n " );
80
79
}
81
80
}
82
81
@@ -131,21 +130,21 @@ static const char *stringifyAction(AllocatorAction Action) {
131
130
132
131
// The chunk is not in a state congruent with the operation we want to perform.
133
132
// This is usually the case with a double-free, a realloc of a freed pointer.
134
- void NORETURN reportInvalidChunkState (AllocatorAction Action, void *Ptr) {
133
+ void NORETURN reportInvalidChunkState (AllocatorAction Action, const void *Ptr) {
135
134
ScopedErrorReport Report;
136
135
Report.append (" invalid chunk state when %s address %p\n " ,
137
136
stringifyAction (Action), Ptr);
138
137
}
139
138
140
- void NORETURN reportMisalignedPointer (AllocatorAction Action, void *Ptr) {
139
+ void NORETURN reportMisalignedPointer (AllocatorAction Action, const void *Ptr) {
141
140
ScopedErrorReport Report;
142
141
Report.append (" misaligned pointer when %s address %p\n " ,
143
142
stringifyAction (Action), Ptr);
144
143
}
145
144
146
145
// The deallocation function used is at odds with the one used to allocate the
147
146
// chunk (eg: new[]/delete or malloc/delete, and so on).
148
- void NORETURN reportDeallocTypeMismatch (AllocatorAction Action, void *Ptr,
147
+ void NORETURN reportDeallocTypeMismatch (AllocatorAction Action, const void *Ptr,
149
148
u8 TypeA, u8 TypeB) {
150
149
ScopedErrorReport Report;
151
150
Report.append (" allocation type mismatch when %s address %p (%d vs %d)\n " ,
@@ -154,7 +153,7 @@ void NORETURN reportDeallocTypeMismatch(AllocatorAction Action, void *Ptr,
154
153
155
154
// The size specified to the delete operator does not match the one that was
156
155
// passed to new when allocating the chunk.
157
- void NORETURN reportDeleteSizeMismatch (void *Ptr, uptr Size,
156
+ void NORETURN reportDeleteSizeMismatch (const void *Ptr, uptr Size,
158
157
uptr ExpectedSize) {
159
158
ScopedErrorReport Report;
160
159
Report.append (
0 commit comments