Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

2 Commits

Author SHA1 Message Date
bol-van
d41151ef6f nfqws2: join fragments in quic CRYPTO reconstruction. allow intersections 2026-03-05 18:38:44 +03:00
bol-van
60ac3693fc nfqws2: optimize quic CRYPTO defrag 2026-03-05 09:41:41 +03:00
3 changed files with 13 additions and 12 deletions

View File

@@ -250,6 +250,7 @@ jobs:
arm64-v8a)
# not safe without GC64
SYSMALLOC=
PAGESIZE="-Wl,-z,max-page-size=16384"
;;
esac
@@ -290,7 +291,7 @@ jobs:
# zapret2
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -I$DEPS_DIR/include $CPU" \
LDFLAGS="-L$DEPS_DIR/lib" \
LDFLAGS="-L$DEPS_DIR/lib $PAGESIZE" \
make -C zapret2 LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB" -j$(nproc) android
# strip unwanted ELF sections to prevent warnings on old Android versions

View File

@@ -270,5 +270,6 @@ v0.9.4.3
0.9.4.5
* github: rollback to lj_alloc in luajit for arm64 and mips64
* github: use 16K page size for android arm64 build
* nfqws2: join fragments in quic CRYPTO reconstruction. allow intersections.

View File

@@ -1294,28 +1294,27 @@ bool QUICDefragCrypto(const uint8_t *clean,size_t clean_len, uint8_t *defrag,siz
if ((pos+sz)>clean_len) return false;
if ((offset+sz)>defrag_data_len) return false; // defrag buf overflow
// remove exact duplicates early to save cpu
for(i=0;i<range;i++)
if (ranges[i].offset==offset && ranges[i].len==sz)
goto skip_range;
if (zeropos < offset)
// make sure no uninitialized gaps exist in case of not full fragment coverage
memset(defrag_data+zeropos,0,offset-zeropos);
if ((offset+sz) > zeropos)
zeropos=offset+sz;
memcpy(defrag_data+offset,clean+pos,sz);
if ((offset+sz) > szmax) szmax = offset+sz;
found=true;
pos+=sz;
// remove exact duplicates early to save cpu
for(i=0;i<range;i++)
if (ranges[i].offset==offset && ranges[i].len==sz)
goto endloop;
if ((offset+sz) > szmax) szmax = offset+sz;
memcpy(defrag_data+offset,clean+pos,sz);
ranges[range].offset = offset;
ranges[range].len = sz;
range++;
skip_range:
pos+=sz;
}
endloop:
}
if (found)
{