forked from FFmpeg/FFmpeg
avutil/file: fix av_file_map file mapping on Windows
This makes the behavior of av_file_map() the same on Windows as it is on other platforms. The file is opened as read-only, but the mapping is copy-on-write, allowing the user to write to the memory pages returned by av_file_map(). This commit fixes libavutil\tests\file.c test, which would crash when trying to write to a read-only memory page. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
90af8e07b0
commit
92deed9732
1 changed files with 1 additions and 1 deletions
|
@ -112,7 +112,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, *size);
|
ptr = MapViewOfFile(mh, FILE_MAP_COPY, 0, 0, *size);
|
||||||
CloseHandle(mh);
|
CloseHandle(mh);
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in MapViewOfFile()\n");
|
av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in MapViewOfFile()\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue