Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
#454: fixed buffer overrun
Browse files Browse the repository at this point in the history
and compiler warnings on VC++
  • Loading branch information
hugbug committed Oct 20, 2017
1 parent c59ab2d commit da9c8b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion daemon/nntp/Decoder.cpp
Expand Up @@ -244,7 +244,11 @@ int Decoder::DecodeYenc(char* buffer, char* outbuf, int len)
// switch back to line mode to process '=yend'- or eof- marker
m_lineBuf.SetLength(0);
m_lineBuf.Append(endseq == 1 ? "=y" : ".\r\n");
m_lineBuf.Append((const char*)src, len - (int)((const char*)src - buffer));
int rem = len - (int)((const char*)src - buffer);
if (rem > 0)
{
m_lineBuf.Append((const char*)src, rem);
}
m_body = false;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/yencode/SimdDecoder.cpp
Expand Up @@ -25,7 +25,7 @@
#ifdef WIN32
#define FORCE_INLINE __forceinline
#else
#define FORCE_INLINE __attribute__((always_inline))
#define FORCE_INLINE __attribute__((always_inline)) inline
#endif

// combine two 8-bit ints into a 16-bit one
Expand Down Expand Up @@ -207,7 +207,7 @@ alignas(32) __m64 unshufLUT[256];
template<bool use_ssse3>
struct do_decode_sse {
FORCE_INLINE
static inline void do_decode(size_t& dLen, const uint8_t* dSrc, unsigned char*& p, unsigned char& escFirst, uint16_t& nextMask) {
static void do_decode(size_t& dLen, const uint8_t* dSrc, unsigned char*& p, unsigned char& escFirst, uint16_t& nextMask) {
long dI = -(long)dLen;

for(; dI; dI += sizeof(__m128i)) {
Expand Down Expand Up @@ -446,7 +446,7 @@ alignas(32) uint8x8_t unshufLUT[256];

struct do_decode_neon {
FORCE_INLINE
static inline void do_decode(size_t& dLen, const uint8_t* dSrc, unsigned char*& p, unsigned char& escFirst, uint16_t& nextMask) {
static void do_decode(size_t& dLen, const uint8_t* dSrc, unsigned char*& p, unsigned char& escFirst, uint16_t& nextMask) {
long dI = -(long)dLen;

for(; dI; dI += sizeof(uint8x16_t)) {
Expand Down

0 comments on commit da9c8b1

Please sign in to comment.