Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check MMDB_get_metadata_as_entry_data_list return value #178

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/clang-addresssanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
schedule:
- cron: '53 3 * * SUN'

permissions: {}

jobs:
addresssanitizer:
name: Clang AddressSanitizer
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 @@ -6,6 +6,8 @@ on:
schedule:
- cron: '45 3 * * SUN'

permissions: {}

jobs:
run:
name: "Clang Static Analysis"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
schedule:
- cron: '45 3 * * SUN'

permissions: {}

jobs:
run:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
schedule:
- cron: '45 3 * * SUN'

permissions: {}

jobs:
run:
runs-on: ${{ matrix.operating-system }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

1.12.1
-------------------

* The C extension now checks that the database metadata lookup was
successful.

1.12.0 (2024-11-14)
-------------------

Expand Down
10 changes: 9 additions & 1 deletion ext/maxminddb.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,15 @@ PHP_METHOD(MaxMind_Db_Reader, metadata) {
object_init_ex(return_value, metadata_ce);

MMDB_entry_data_list_s *entry_data_list;
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
int status =
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
if (status != MMDB_SUCCESS) {
zend_throw_exception_ex(maxminddb_exception_ce,
0 TSRMLS_CC,
"Error while decoding metadata. %s",
MMDB_strerror(status));
return;
}

zval metadata_array;
const MMDB_entry_data_list_s *rv =
Expand Down
Loading