Anonymous | Login | 2024-12-02 07:38 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0001153 | [1003.1(2016/18)/Issue7+TC2] System Interfaces | Editorial | Clarification Requested | 2017-06-22 08:02 | 2024-06-11 09:09 | ||
Reporter | Villemoes | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | ||||||
Name | Rasmus Villemoes | ||||||
Organization | |||||||
User Reference | |||||||
Section | fmemopen | ||||||
Page Number | |||||||
Line Number | |||||||
Interp Status | --- | ||||||
Final Accepted Text | See Note: 0004186 | ||||||
Summary | 0001153: fread/fwrite to/from buffer underlying the memory stream | ||||||
Description |
In glibc, running the code below under valgrind gives a Source and destination overlap in memcpy Without the setvbuf calls, this doesn't trigger because the reads and writes happen via an internal buffer. I cannot find anything that says the application cannot do fread/fwrite calls on a memory stream, using part of the stream's underlying buffer as destination/source. #include <stdio.h> int main(int argc, char *argv[]) { char x[4] = "123"; char y[4] = "abc"; FILE *f = fmemopen(x, 3, "r"); FILE *g = fmemopen(y, 3, "w"); setvbuf(f, NULL, _IONBF, 0); setvbuf(g, NULL, _IONBF, 0); fread(&x[1], 1, 2, f); fwrite(&y[1], 1, 2, g); printf("x = %s\n", x); printf("y = %s\n", y); fclose(f); fclose(g); printf("x = %s\n", x); printf("y = %s\n", y); return 0; } |
||||||
Desired Action | Clarify whether the implementation must behave as if it was using memmove internally, or alternatively, that it is up to the application to avoid fread/fwrite calls on memory streams that will trigger such copies. The latter seems hard to do in general. | ||||||
Tags | tc3-2008 | ||||||
Attached Files | |||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
2017-06-22 08:02 | Villemoes | New Issue | |
2017-06-22 08:02 | Villemoes | Status | New => Under Review |
2017-06-22 08:02 | Villemoes | Assigned To | => ajosey |
2017-06-22 08:02 | Villemoes | Name | => Rasmus Villemoes |
2017-06-22 08:02 | Villemoes | Section | => fmemopen |
2018-12-13 16:59 | nick | Note Added: 0004186 | |
2018-12-13 17:00 | nick | Interp Status | => --- |
2018-12-13 17:00 | nick | Status | Under Review => Resolved |
2018-12-13 17:00 | nick | Resolution | Open => Accepted As Marked |
2018-12-13 17:00 | nick | Final Accepted Text | => See Note: 0004186 |
2018-12-13 17:01 | nick | Tag Attached: tc3-2008 | |
2018-12-13 17:02 | geoffclare | Project | 1003.1(2008)/Issue 7 => 1003.1(2016/18)/Issue7+TC2 |
2019-11-07 09:23 | geoffclare | Status | Resolved => Applied |
2024-06-11 09:09 | agadmin | Status | Applied => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |