File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,19 +183,19 @@ struct HttpParser {
183183 uint64_t remainingStreamingBytes = 0 ;
184184
185185 /* Returns UINT_MAX on error. Maximum 999999999 is allowed. */
186- static unsigned int toUnsignedInteger (std::string_view str) {
187- /* We assume at least 32 -bit integer giving us safely 999999999 (9 number of 9s) */
188- if (str.length () > 9 ) {
186+ static uint64_t toUnsignedInteger (std::string_view str) {
187+ /* We assume at least 64 -bit integer giving us safely 999999999999999999 (18 number of 9s) */
188+ if (str.length () > 18 ) {
189189 return UINT_MAX ;
190190 }
191191
192- unsigned int unsignedIntegerValue = 0 ;
192+ uint64_t unsignedIntegerValue = 0 ;
193193 for (char c : str) {
194194 /* As long as the letter is 0-9 we cannot overflow. */
195195 if (c < ' 0' || c > ' 9' ) {
196196 return UINT_MAX ;
197197 }
198- unsignedIntegerValue = unsignedIntegerValue * 10u + ((unsigned int ) c - (unsigned int ) ' 0' );
198+ unsignedIntegerValue = unsignedIntegerValue * 10ull + ((unsigned int ) c - (unsigned int ) ' 0' );
199199 }
200200 return unsignedIntegerValue;
201201 }
You can’t perform that action at this time.
0 commit comments