Little question about BitSet

zhaozj2021-02-16  57

In the documentation, it is basically a CTOR that defines the bitset:

bitset (const basic_string & _Str, typename basic_string :: size_type _Pos = 0, typename basic_string :: size_type _Count = basic_string :: npos;

In VC71 and SLTPORT, there is no such definition in the source code. Instead, it is two functions. The following is the code of VC71: Explicit BitSet (const Basic_String <_ELEM, _TR, _SIZE_TYPE _POS = 0) { // Construct from [_pos, ...) Elements in string _contruct (_STR, _POS, Basic_String <_lex, _tr, _alloc> :: npos);

explicit bitset (const basic_string <_Elem, _Tr, _Alloc> & _Str, _BITSET_SIZE_TYPE _Pos, _BITSET_SIZE_TYPE _Count) {// construct from [_Pos, _Pos _Count) elements in string _Construct (_Str, _Pos, _Count);}

This may not have any problems.

However, this may be a problem below:

IF (_STR [--_ POS] == '1') set (_num); Else IF (_str [_pos]! = '0') _XINV ();

Because according to the definition of the CTOR, I may pass a WString function, which is playing.

STL is also good, other C libraries are also good, often vulnerabilities in Wide Character, because they generally don't use the reason. Why can't we fix these mistakes?

转载请注明原文地址:https://www.9cbs.com/read-18383.html

New Post(0)