Skip to content

Commit

Permalink
Merge tag '1.12.2' into ubuntu-ppa
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Jan 10, 2025
2 parents c673752 + cba618d commit 4af41f5
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/clang-addresssanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false
- run: sudo apt install clang libipc-run3-perl
- run: ./bootstrap
- run: ./configure
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/clang-analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- run: sudo apt install clang-tools libipc-run3-perl
- run: ./bootstrap
- run: scan-build ./configure
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
# a pull request then we can checkout the head.
fetch-depth: 2
submodules: true
persist-credentials: false

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false
- run: sudo apt install libipc-run3-perl
if: ${{ matrix.os == 'ubuntu-latest' }}
- run: brew install autoconf automake libtool
Expand All @@ -41,6 +42,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false
- run: cmake -DBUILD_TESTING=ON .
- run: cmake --build .
- run: ctest -V . -C Debug
32 changes: 32 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: GitHub Actions Security Analysis with zizmor

on:
push:
branches: ["main"]
pull_request:
branches: ["**"]

jobs:
zizmor:
name: zizmor latest via PyPI
runs-on: ubuntu-latest
permissions:
security-events: write
# required for workflows in private repositories
contents: read
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: false

- name: Run zizmor
run: uvx zizmor --format plain .
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.9...3.30)

project(maxminddb
LANGUAGES C
VERSION 1.12.0
VERSION 1.12.2
)
set(MAXMINDDB_SOVERSION 0.0.7)
set(CMAKE_C_STANDARD 99)
Expand Down
18 changes: 18 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 1.12.2 - 2025-01-10

* `MMDB_get_entry_data_list()` now always sets the passed `entry_data_list`
parameter to either `NULL` or valid memory. This makes it safe for
callers to use `MMDB_free_entry_data_list()` on it even in case of error.
In 1.12.0 `MMDB_get_entry_data_list()` was changed to not set this
parameter to valid memory in additional error cases. That change caused
segfaults for certain libraries that assumed it was safe to free memory
on error. Doing so was never safe, but worked in some cases. This change
makes such calls safe. Reported by Petr Pisar. GitHub
maxmind/MaxMind-DB-Reader-XS#39.

## 1.12.1 - 2025-01-08

* Added missing `cmake_uninstall.cmake.in` to the source distribution. This
was missing from 1.12.0, causing CMake builds to fail. Reported by Marcel
Raad. GitHub #367.

## 1.12.0 - 2025-01-07

* Fixed memory leaks in `MMDB_open()`. These could happen with invalid
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endif

EXTRA_DIST = doc Changes.md LICENSE NOTICE README.md \
CMakeLists.txt t/CMakeLists.txt bin/CMakeLists.txt \
include/maxminddb_config.h.cmake.in
cmake_uninstall.cmake.in include/maxminddb_config.h.cmake.in

dist-hook:
dev-bin/make-man-pages.pl $(distdir)
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([libmaxminddb], [1.12.0], [[email protected]])
AC_INIT([libmaxminddb], [1.12.2], [[email protected]])
AC_CONFIG_SRCDIR([include/maxminddb.h])
AC_CONFIG_HEADERS([config.h include/maxminddb_config.h])

Expand Down
8 changes: 6 additions & 2 deletions src/data-pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,13 @@ int main(void) {
}

static void test_can_multiply(void) {
{ ok(can_multiply(SIZE_MAX, 1, SIZE_MAX), "1*SIZE_MAX is ok"); }
{
ok(can_multiply(SIZE_MAX, 1, SIZE_MAX), "1*SIZE_MAX is ok");
}

{ ok(!can_multiply(SIZE_MAX, 2, SIZE_MAX), "2*SIZE_MAX is not ok"); }
{
ok(!can_multiply(SIZE_MAX, 2, SIZE_MAX), "2*SIZE_MAX is not ok");
}

{
ok(can_multiply(SIZE_MAX, 10240, sizeof(MMDB_entry_data_list_s)),
Expand Down
2 changes: 2 additions & 0 deletions src/maxminddb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,8 @@ int MMDB_get_metadata_as_entry_data_list(

int MMDB_get_entry_data_list(MMDB_entry_s *start,
MMDB_entry_data_list_s **const entry_data_list) {
*entry_data_list = NULL;

MMDB_data_pool_s *const pool = data_pool_new(MMDB_POOL_INIT_SIZE);
if (!pool) {
return MMDB_OUT_OF_MEMORY_ERROR;
Expand Down
5 changes: 5 additions & 0 deletions t/bad_pointers_t.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ void run_tests(int mode, const char *mode_desc) {
MMDB_INVALID_DATA_ERROR,
"MMDB_get_entry_data_list returns MMDB_INVALID_DATA_ERROR for "
"bad pointer in data section");

// This is not necessary as on error we should not need to free
// anything. However test that it is safe to do so. See change in
// 1.12.2.
MMDB_free_entry_data_list(entry_data_list);
}

{
Expand Down
4 changes: 3 additions & 1 deletion t/data-pool-t.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ static void test_data_pool_new(void) {
}

static void test_data_pool_destroy(void) {
{ data_pool_destroy(NULL); }
{
data_pool_destroy(NULL);
}

{
MMDB_data_pool_s *const pool = data_pool_new(512);
Expand Down
12 changes: 5 additions & 7 deletions t/fuzz_mmdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

extern int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);

int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
int status;
FILE *fp;
MMDB_s mmdb;
char filename[256];
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int status;
FILE *fp;
MMDB_s mmdb;
char filename[256];

if (size < kMinInputLength || size > kMaxInputLength)
return 0;
Expand Down

0 comments on commit 4af41f5

Please sign in to comment.