Skip to content

Commit 8218115

Browse files
authored
Merge pull request #183 from maxmind/greg/eng-1019
Check MMDB_get_metadata_as_entry_data_list return value
2 parents 2a3b007 + ee1ab38 commit 8218115

File tree

9 files changed

+25
-1
lines changed

9 files changed

+25
-1
lines changed

.github/workflows/address-sanitizer.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
schedule:
66
- cron: '13 15 * * SUN'
7+
8+
permissions: {}
9+
710
jobs:
811
build:
912
name: Address Sanitizer

.github/workflows/clang-analyzer.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
schedule:
77
- cron: '3 15 * * SUN'
88

9+
permissions: {}
10+
911
jobs:
1012
clang-analyzer:
1113
name: Clang Static Analysis

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
schedule:
99
- cron: '0 18 * * 0'
1010

11+
permissions: {}
12+
1113
jobs:
1214
CodeQL-Build:
1315

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
types:
1111
- published
1212

13+
permissions: {}
14+
1315
jobs:
1416
build_wheels:
1517
name: Build wheels on ${{ matrix.os }}

.github/workflows/test-libmaxminddb.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
schedule:
77
- cron: '3 15 * * SUN'
88

9+
permissions: {}
10+
911
jobs:
1012
build:
1113

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
schedule:
77
- cron: '3 15 * * SUN'
88

9+
permissions: {}
10+
911
jobs:
1012
build:
1113

.github/workflows/zizmor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
pull_request:
77
branches: ["**"]
88

9+
permissions: {}
10+
911
jobs:
1012
zizmor:
1113
name: zizmor latest via PyPI

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ History
77
++++++++++++++++++
88

99
* The vendored ``libmaxminddb`` has been updated to 1.12.2.
10+
* The C extension now checks that the database metadata lookup was
11+
successful.
1012

1113
2.6.3 (2025-01-09)
1214
++++++++++++++++++

extension/maxminddb.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,14 @@ static PyObject *Reader_metadata(PyObject *self, PyObject *UNUSED(args)) {
351351
}
352352

353353
MMDB_entry_data_list_s *entry_data_list;
354-
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
354+
int status =
355+
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
356+
if (status != MMDB_SUCCESS) {
357+
PyErr_Format(MaxMindDB_error,
358+
"Error decoding metadata. %s",
359+
MMDB_strerror(status));
360+
return NULL;
361+
}
355362
MMDB_entry_data_list_s *original_entry_data_list = entry_data_list;
356363

357364
PyObject *metadata_dict = from_entry_data_list(&entry_data_list);

0 commit comments

Comments
 (0)