Closed
Bug 553268
Opened 14 years ago
Closed 14 years ago
windows _snprintf() may not work like VMPI_snprintf expects it to
Categories
(Tamarin Graveyard :: Virtual Machine, defect, P2)
Tracking
(Not tracked)
VERIFIED
FIXED
flash10.1
People
(Reporter: edwsmith, Assigned: lhansen)
Details
(Whiteboard: Has patch)
Attachments
(1 file, 3 obsolete files)
7.06 KB,
patch
|
edwsmith
:
review+
|
Details | Diff | Splinter Review |
From Nicholas Nethercote nanojit developer: I just learnt the hard way that snprintf() doesn't exist on Windows. There is _snprintf(), but it's unsafe -- it doesn't guarantee terminating with a NUL char. sprintf_s() is the function that does that. http://msdn.microsoft.com/en-us/library/2ts7cx93%28VS.80%29.aspx http://msdn.microsoft.com/en-us/library/ce3zzk1k%28VS.80%29.aspx I mention it because I see the following lines in TR: ./platform/win32/win32-platform.h:#define VMPI_snprintf ::_snprintf ./VMPI/SpyUtilsWin.cpp: #pragma warning(disable: 4995) //disabling warning for deprecated _snprintf ./VMPI/SpyUtilsWinMo.cpp: #pragma warning(disable: 4995) //disabling warning for deprecated _snprintf
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → lhansen
Priority: -- → P2
Target Milestone: --- → flash10.1
Assignee | ||
Comment 1•14 years ago
|
||
Right. The problem is that _snprintf_s does more than just NUL-terminate, it actually invokes an exception handler if the buffer can't accomodate the output. We probably don't want that.
Assignee | ||
Comment 2•14 years ago
|
||
Implements VMPI_snprintf and VMPI_vsnprintf as functions on Windows, with reasonable semantics. Removes the warning-disabling pragmas for _snprintf usage. Adds VMPI_vsnprintf to all the platform header files (only Windows had it). Changes some uses in the eval code of non-VMPI functions to use VMPI functions - fallout from removing a use of _snprintf.
Attachment #433597 -
Flags: review?(edwsmith)
Assignee | ||
Updated•14 years ago
|
Status: NEW → ASSIGNED
Whiteboard: Has patch
Reporter | ||
Updated•14 years ago
|
Attachment #433597 -
Flags: review?(edwsmith) → review+
Assignee | ||
Comment 4•14 years ago
|
||
tamarin-redux-argo changeset: 3846:1bc40e7217a8 tamarin-redux changeset: 4109:0e6e60921250
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 5•14 years ago
|
||
Looks like this patch does not compile properly on windows mobile: MMgc/GCLog.cpp(49) : error C3861: 'vsnprintf': identifier not found
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 6•14 years ago
|
||
(In reply to comment #5) > Looks like this patch does not compile properly on windows mobile: > > MMgc/GCLog.cpp(49) : error C3861: 'vsnprintf': identifier not found Bummer for Windows Mobile.
Assignee | ||
Comment 7•14 years ago
|
||
These test basic functionality of VMPI_snprintf: - formatting various types - handling buffer overflow and termination - return values To the best of my knowledge I'm going after only ISO C functionality here.
Attachment #434375 -
Flags: review?(edwsmith)
Assignee | ||
Comment 8•14 years ago
|
||
Attachment #434377 -
Flags: review?(edwsmith)
Assignee | ||
Comment 9•14 years ago
|
||
Performs a rough-and-ready parse of the format string and hands individual problems off to _snprintf, and assembles a string from the results. Unlike _snprintf and _vsnprintf it returns the number of chars that would have been printed had the buffer been large enough. Does not quite obsolete patch #433597, but replaces part of it.
Attachment #434380 -
Flags: review?(edwsmith)
Reporter | ||
Updated•14 years ago
|
Attachment #434377 -
Flags: review?(edwsmith) → review+
Assignee | ||
Comment 10•14 years ago
|
||
Comment on attachment 434377 [details] [diff] [review] Turn two calls to vsnprintf into calls to VMPI_vsnprintf Moved to bug #554659.
Attachment #434377 -
Attachment is obsolete: true
Assignee | ||
Comment 11•14 years ago
|
||
Comment on attachment 434375 [details] [diff] [review] Selftests for VMPI_snprintf Cancelling review as patch will be moved.
Attachment #434375 -
Flags: review?(edwsmith)
Assignee | ||
Comment 12•14 years ago
|
||
Comment on attachment 434380 [details] [diff] [review] Reasonably conformant implementation of VMPI_vsnprintf Cancelling review as patch will be moved.
Attachment #434380 -
Flags: review?(edwsmith)
Assignee | ||
Comment 13•14 years ago
|
||
Comment on attachment 434375 [details] [diff] [review] Selftests for VMPI_snprintf Moved to bug #554664
Attachment #434375 -
Attachment is obsolete: true
Assignee | ||
Comment 14•14 years ago
|
||
Comment on attachment 434380 [details] [diff] [review] Reasonably conformant implementation of VMPI_vsnprintf Moved to bug #554664
Attachment #434380 -
Attachment is obsolete: true
Assignee | ||
Comment 15•14 years ago
|
||
(In reply to comment #5) > Looks like this patch does not compile properly on windows mobile: > > MMgc/GCLog.cpp(49) : error C3861: 'vsnprintf': identifier not found That issue is now tracked in bug #554659 as it turned out to be more complicated.
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
No longer depends on: 554659
Resolution: --- → FIXED
Updated•14 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•