Skip to content

Commit

Permalink
VER: Release 0.22.1
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen authored Oct 8, 2024
2 parents c4b0c4a + aae9890 commit 832b63f
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
name: build - Python ${{ matrix.python-version }} (x86_64 ${{ matrix.os }})
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
name: build - Python ${{ matrix.python-version }} (aarch64 linux)
runs-on: ubuntu-latest

Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
name: build - Python ${{ matrix.python-version }} (macOS)
runs-on: macos-latest

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: macos-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: windows-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
target: [x86_64, aarch64]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.22.1 - 2024-10-08

### Enhancements
- Removed support for Python 3.8 in `databento-dbn` due to end of life

### Bug fixes
- Fixed buffer overrun in `c_chars_to_str` on non-null terminated input

## 0.22.0 - 2024-10-01

### Enhancements
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resolver = "2"
[workspace.package]
authors = ["Databento <[email protected]>"]
edition = "2021"
version = "0.22.0"
version = "0.22.1"
documentation = "https://docs.databento.com"
repository = "https://github.com/databento/dbn"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion python/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# databento-dbn

[![build](https://github.com/databento/dbn/actions/workflows/build.yaml/badge.svg)](https://github.com/databento/dbn/actions/workflows/build.yaml)
![python](https://img.shields.io/badge/python-3.8+-blue.svg)
![python](https://img.shields.io/badge/python-3.9+-blue.svg)
![license](https://img.shields.io/github/license/databento/dbn?color=blue)
[![pypi-version](https://img.shields.io/pypi/v/databento_dbn)](https://pypi.org/project/databento-dbn)

Expand Down
8 changes: 4 additions & 4 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[tool.poetry]
name = "databento-dbn"
version = "0.22.0"
version = "0.22.1"
description = "Python bindings for encoding and decoding Databento Binary Encoding (DBN)"
authors = ["Databento <[email protected]>"]
license = "Apache-2.0"

[tool.poetry.dependencies]
python = ">=3.8"
python = ">=3.9"

[tool.poetry.dev-dependencies]
maturin = ">=1.0"
Expand All @@ -17,14 +17,14 @@ build-backend = "maturin"

[project]
name = "databento-dbn"
version = "0.22.0"
version = "0.22.1"
authors = [
{ name = "Databento", email = "[email protected]" }
]
description = "Python bindings for encoding and decoding Databento Binary Encoding (DBN)"
readme = "README.md"
license = { file = "../LICENSE" }
requires-python = ">=3.8"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
Expand Down
2 changes: 1 addition & 1 deletion python/python/databento_dbn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime as dt
from collections.abc import Sequence
from typing import Protocol
from typing import Sequence
from typing import TypedDict

# Import native module
Expand Down
2 changes: 1 addition & 1 deletion rust/dbn-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name = "dbn"
path = "src/main.rs"

[dependencies]
dbn = { path = "../dbn", version = "=0.22.0", default-features = false }
dbn = { path = "../dbn", version = "=0.22.1", default-features = false }

anyhow = { workspace = true }
clap = { version = "4.5", features = ["derive", "wrap_help"] }
Expand Down
2 changes: 1 addition & 1 deletion rust/dbn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ serde = ["dep:serde", "time/parsing", "time/serde"]
trivial_copy = []

[dependencies]
dbn-macros = { version = "=0.22.0", path = "../dbn-macros" }
dbn-macros = { version = "=0.22.1", path = "../dbn-macros" }

async-compression = { version = "0.4.11", features = ["tokio", "zstd"], optional = true }
csv = { workspace = true }
Expand Down
44 changes: 42 additions & 2 deletions rust/dbn/src/record/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ pub fn str_to_c_chars<const N: usize>(s: &str) -> Result<[c_char; N]> {
/// None.
///
/// # Errors
/// This function returns an error if `chars` contains invalid UTF-8.
/// This function returns an error if `chars` contains invalid UTF-8 or is not null-terminated.
pub fn c_chars_to_str<const N: usize>(chars: &[c_char; N]) -> Result<&str> {
let cstr = unsafe { CStr::from_ptr(chars.as_ptr()) };
// Safety: Casting from i8 to u8 slice should be safe
let bytes = unsafe { as_u8_slice(chars) };
let cstr = CStr::from_bytes_until_nul(bytes).map_err(|_| Error::Conversion {
input: format!("{chars:?}"),
desired_type: "CStr (null-terminated)",
})?;

cstr.to_str()
.map_err(|e| Error::utf8(e, format!("converting c_char array: {chars:?}")))
}
Expand Down Expand Up @@ -168,3 +174,37 @@ pub(crate) mod cstr_serde {
str_to_c_chars(&str).map_err(de::Error::custom)
}
}

#[cfg(test)]
mod tests {
use super::*;
use std::os::raw::c_char;

#[test]
fn test_c_chars_to_str_success() {
let null_terminated: [c_char; 5] = [
'A' as c_char,
'A' as c_char,
'A' as c_char,
'A' as c_char,
0,
];
let result = c_chars_to_str(&null_terminated);
assert_eq!(result.unwrap(), "AAAA");
}

#[test]
fn test_c_chars_to_str_failure_on_missing_null_terminator() {
let non_null_terminated: [c_char; 5] = ['A' as c_char; 5];
let err = c_chars_to_str(&non_null_terminated)
.expect_err("Expected failure on non-null terminated string");

assert!(matches!(
err,
Error::Conversion {
input: _,
desired_type: "CStr (null-terminated)",
}
));
}
}

0 comments on commit 832b63f

Please sign in to comment.