From fb872ebaf88ccf9c77000b34856c8a0edc49c15f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:53:24 -0500 Subject: [PATCH 1/2] Release 0.8.1 (#256) Co-authored-by: github-actions --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- src/hyperscan/_version.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63e4bf9..bbc529b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ +## v0.8.1 — 2026-02-11 + + + ## v0.8.0 — 2025-12-06 ### Features - add buffer protocol support for zero-copy scanning (#251) diff --git a/pyproject.toml b/pyproject.toml index 1a1ee6b..d62e954 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperscan" -version = "0.8.0" +version = "0.8.1" description = "Python bindings for Hyperscan." readme = "README.md" authors = [{ name = "David Gidwani", email = "david.gidwani@atomweight.io" }] diff --git a/src/hyperscan/_version.py b/src/hyperscan/_version.py index 777f190..8088f75 100644 --- a/src/hyperscan/_version.py +++ b/src/hyperscan/_version.py @@ -1 +1 @@ -__version__ = "0.8.0" +__version__ = "0.8.1" From 99cdf90380bb200aa7b2dd851b503f9c6b3b1d83 Mon Sep 17 00:00:00 2001 From: p1geondove Date: Wed, 11 Mar 2026 03:33:53 +0100 Subject: [PATCH 2/2] fix: correct match offset truncation for buffers larger than 4GB --- src/hyperscan/extension.c | 4 ++-- tests/test_hyperscan.py | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/hyperscan/extension.c b/src/hyperscan/extension.c index 57ce975..e072d10 100644 --- a/src/hyperscan/extension.c +++ b/src/hyperscan/extension.c @@ -238,7 +238,7 @@ static int hs_match_handler( PyGILState_STATE gstate; gstate = PyGILState_Ensure(); PyObject *rv = PyObject_CallFunction( - cctx->callback, "IIIIO", id, from, to, flags, cctx->ctx); + cctx->callback, "IKKIO", id, from, to, flags, cctx->ctx); int halt = 1; if (rv == NULL) { cctx->success = 0; @@ -273,7 +273,7 @@ static int ch_match_handler( } PyObject *rv = PyObject_CallFunction( cctx->callback, - "IIIIOO", + "IKKIOO", id, from, to, diff --git a/tests/test_hyperscan.py b/tests/test_hyperscan.py index e762b3b..e20f9d2 100644 --- a/tests/test_hyperscan.py +++ b/tests/test_hyperscan.py @@ -506,3 +506,30 @@ def on_test_match(pattern_id, from_offset, to_offset, flags, context): test_db.scan(b"test", match_event_handler=on_test_match) assert len(test_matches) > 0, "Basic pattern matching should work" + + +def test_vectored_scan_large_offset(database_vector, mocker): + callback = mocker.Mock(return_value=None) + buffers = [ + b"x"*(2**32-1), + b"fo" + ] + database_vector.scan(buffers, match_event_handler=callback) + callback.assert_has_calls( + [ + mocker.call(0,0,2**32+1,0,None), + ], + any_order=True + ) + + +def test_stream_scan_large_offset(database_stream, mocker): + callback = mocker.Mock(return_value=None) + with database_stream.stream(match_event_handler=callback) as stream: + stream.scan(b"x"*(2**32-1)) + stream.scan(b"fo") + callback.assert_has_calls( + [ + mocker.call(0,0,2**32+1,0,None) + ] + )