Index: src/vdbe.c ================================================================== --- src/vdbe.c +++ src/vdbe.c @@ -2606,11 +2606,11 @@ sqlite3VdbeMemExpandBlob(pRec); } serial_type = sqlite3VdbeSerialType(pRec, file_format); len = sqlite3VdbeSerialTypeLen(serial_type); nData += len; - nHdr += sqlite3VarintLen(serial_type); + nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type); if( pRec->flags & MEM_Zero ){ /* Only pure zero-filled BLOBs can be input to this Opcode. ** We do not allow blobs with a prefix and a zero-filled tail. */ nZero += pRec->u.nZero; }else if( len ){ @@ -2617,13 +2617,18 @@ nZero = 0; } } /* Add the initial header varint and total the size */ - nHdr += nVarint = sqlite3VarintLen(nHdr); - if( nVarintdb->aLimit[SQLITE_LIMIT_LENGTH] ){ goto too_big; }