Opened 11 years ago

Closed 11 years ago

#5771 closed Bugs (wontfix)

warning C4996 occurs during compilation of basic_binary_iprimitive::load_binary because of the call to sgetn method

Reported by: Anton Matosov <anton.matosov@…> Owned by: Robert Ramey
Milestone: Boost 1.48.0 Component: serialization
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:

Description

warning C4996 occurs during compilation of basic_binary_iprimitive::load_binary because of the call to sgetn method:

warning C4996: 'std::basic_streambuf<_Elem,_Traits>::sgetn': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' e:\boost\include\boost-1_46_1\boost\archive\basic_binary_iprimitive.hpp 161

Minimal code to reproduce:

#include <boost/archive/binary_iarchive.hpp>

easy solution for this is to use _Sgetn_s for VC 8.0 and higher.

Patch with a quick fix is attached to the ticket.

Attachments (1)

warning in basic_binary_iprimitive.hpp.patch (1.4 KB ) - added by Anton Matosov <anton.matosov@…> 11 years ago.

Download all attachments as: .zip

Change History (2)

by Anton Matosov <anton.matosov@…>, 11 years ago

comment:1 by anonymous, 11 years ago

Resolution: wontfix
Status: newclosed

I've looked at the patch. I'm loath to start going down this path. Basically the microsoft version is not standard conforming. To start doing this I'd have to do this all over the code and I'm not inclined to do it. The benefit would not be worth all the effort. It would also make the code harder to read than it already is. You can eliminate these warnings with a compile time switch.

Robert Ramey

Note: See TracTickets for help on using tickets.