Skip to content

Commit

Permalink
Fixes #47
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu committed May 1, 2023
1 parent 764a7bc commit a98811a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="appthreat-vulnerability-db",
version="5.1.1",
version="5.1.2",
author="Team AppThreat",
author_email="cloud@appthreat.com",
description="AppThreat's vulnerability database and package search library with a built-in file based storage. OSV, CVE, GitHub, npm are the primary sources of vulnerabilities.",
Expand Down
15 changes: 13 additions & 2 deletions vdb/lib/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

read_size = 256
batch_write_size = 20
max_buffer_size = 10 * 1024 * 1024 # 10 MiB


def store(datas, db_file=config.vdb_bin_file, index_file=config.vdb_bin_index):
Expand Down Expand Up @@ -67,7 +68,12 @@ def stream_read(db_file=config.vdb_bin_file):
return data_list
with open(db_file, mode="rb") as fp:
unpacker = msgpack.Unpacker(
fp, read_size=read_size, use_list=1, strict_map_key=False
fp,
read_size=read_size,
use_list=1,
strict_map_key=False,
raw=False,
max_buffer_size=max_buffer_size,
)
for unpacked in unpacker:
if unpacked:
Expand All @@ -93,7 +99,12 @@ def stream_bulk_search(match_list, key_func, db_file=config.vdb_bin_file):
if store_pos and store_pos.isdigit():
fp.seek(int(store_pos))
unpacker = msgpack.Unpacker(
fp, read_size=read_size, use_list=1, strict_map_key=False
fp,
read_size=read_size,
use_list=1,
strict_map_key=False,
raw=False,
max_buffer_size=max_buffer_size,
)
for unpacked in unpacker:
if isinstance(unpacked, list):
Expand Down

0 comments on commit a98811a

Please sign in to comment.