We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base64Decoder&Base64Encoder not work correctly.
any version <=1.9.0
gcc 版本 8.2.0 (GCC)
4.17.12-arch1-1-ARCH #1 SMP PREEMPT Fri Aug 3 07:16:41 UTC 2018 x86_64 GNU/Linux
this bug can be fix Base64Decoder.cpp: int Base64DecoderBuf::readFromDevice() , can be fix like this way: _group[0] = (_pInEncoding[buffer[0]] << 2) | ((_pInEncoding[buffer[1]] >> 4) & 0x03); _group[1] = ((_pInEncoding[buffer[1]] << 4) & 0xF0) | ((_pInEncoding[buffer[2]]>> 2)&0x0f) ; _group[2] = ((_pInEncoding[buffer[2]] << 6)&0xC0) | (_pInEncoding[buffer[3]] & 0x3f);
Base64Encoder.cpp:
int Base64EncoderBuf::writeToDevice(char c) { static const int eof = std::char_traits<char>::eof(); _group[_groupLength++] = (unsigned char) c; if (_groupLength == 3) { unsigned char idx; idx = (0xfc&_group[0]) >> 2; if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; idx = ((_group[0] & 0x03) << 4) | ((_group[1]&0xf0) >> 4); if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; idx = ((_group[1] & 0x0F) << 2) | ((_group[2]&0xc0) >> 6); if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; idx = _group[2] & 0x3F; if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; _pos += 4; if (_lineLength > 0 && _pos >= _lineLength) { if (_buf.sputc('\r') == eof) return eof; if (_buf.sputc('\n') == eof) return eof; _pos = 0; } _groupLength = 0; } return charToInt(c); } int Base64EncoderBuf::close() { static const int eof = std::char_traits<char>::eof(); if (sync() == eof) return eof; if (_groupLength == 1) { _group[1] = 0; unsigned char idx; idx = (0xfc&_group[0]) >> 2; if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; idx = ((_group[0] & 0x03) << 4) | ((_group[1]&0xf0) >> 4); if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; if (!(_options & BASE64_NO_PADDING)) { if (_buf.sputc('=') == eof) return eof; if (_buf.sputc('=') == eof) return eof; } } else if (_groupLength == 2) { _group[2] = 0; unsigned char idx; idx = (0xfc&_group[0]) >> 2; if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; idx = ((_group[0] & 0x03) << 4) | ((_group[1]&0xf0) >> 4); if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; idx = ((_group[1] & 0x0F) << 2) | ((_group[2]&0xc0) >> 6); if (_buf.sputc(_pOutEncoding[idx]) == eof) return eof; if (!(_options & BASE64_NO_PADDING)) { if (_buf.sputc('=') == eof) return eof; } } _groupLength = 0; return _buf.pubsync(); }
The text was updated successfully, but these errors were encountered:
This issue is stale because it has been open for 365 days with no activity.
Sorry, something went wrong.
need more information (best is code demonstrating the problem)
This issue was closed because it has been inactive for 60 days since being marked as stale.
No branches or pull requests
Actual behavior
Base64Decoder&Base64Encoder not work correctly.
POCO version
any version <=1.9.0
Compiler and version
gcc 版本 8.2.0 (GCC)
Operating system and version
4.17.12-arch1-1-ARCH #1 SMP PREEMPT Fri Aug 3 07:16:41 UTC 2018 x86_64 GNU/Linux
Other relevant information
this bug can be fix
Base64Decoder.cpp:
int Base64DecoderBuf::readFromDevice() , can be fix like this way:
_group[0] = (_pInEncoding[buffer[0]] << 2) | ((_pInEncoding[buffer[1]] >> 4) & 0x03);
_group[1] = ((_pInEncoding[buffer[1]] << 4) & 0xF0) | ((_pInEncoding[buffer[2]]>> 2)&0x0f) ;
_group[2] = ((_pInEncoding[buffer[2]] << 6)&0xC0) | (_pInEncoding[buffer[3]] & 0x3f);
Base64Encoder.cpp:
The text was updated successfully, but these errors were encountered: