File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -216,17 +216,18 @@ Expected<MappedFileRegionArena> MappedFileRegionArena::create(
216216 if (!Size)
217217 return Size.takeError ();
218218
219- Header *H = reinterpret_cast <Header *>(HeaderContent.data ());
220- if (H->HeaderOffset != HeaderOffset)
219+ Header H;
220+ memcpy (&H, HeaderContent.data (), sizeof (H));
221+ if (H.HeaderOffset != HeaderOffset)
221222 return createStringError (
222223 std::make_error_code (std::errc::invalid_argument),
223224 " specified header offset (" + utostr (HeaderOffset) +
224- " ) does not match existing config (" + utostr (H-> HeaderOffset ) +
225+ " ) does not match existing config (" + utostr (H. HeaderOffset ) +
225226 " )" );
226227
227228 // If the capacity doesn't match, use the existing capacity instead.
228- if (H-> Capacity != Capacity)
229- Capacity = H-> Capacity ;
229+ if (H. Capacity != Capacity)
230+ Capacity = H. Capacity ;
230231 }
231232
232233 // If the size is smaller than capacity, we need to resize the file.
You can’t perform that action at this time.
0 commit comments