{"answers":{"affected":"3 open source packages ship an affected version, including glib.","exploited":"There is no known exploitation of GHSA-wrw7-89jp-8q8g in the wild and no public exploit code.","fix":"Upgrade glib to 0.20.0 or later.","what":"GHSA-wrw7-89jp-8q8g is a vulnerability in glib, published on 30 Mar 2024."},"fix_prompt":"Check this codebase for GHSA-wrw7-89jp-8q8g and fix it if it is affected.\n\nWhat it is: GHSA-wrw7-89jp-8q8g is a vulnerability in glib, published on 30 Mar 2024. \nExploitation: There is no known exploitation of GHSA-wrw7-89jp-8q8g in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- glib (crates.io): affected from 0.15.0; fixed in 0.20.0\n- glib (crates.io): affected from 0.15.0; fixed in 0.20.0\n- glib (crates.io): affected from 0.15.0; fixed in 0.20.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-wrw7-89jp-8q8g/ (Markdown: https://insights.sbomify.com/GHSA-wrw7-89jp-8q8g/index.md)","id":"GHSA-wrw7-89jp-8q8g","markdown":"https://insights.sbomify.com/GHSA-wrw7-89jp-8q8g/index.md","name":"GHSA-wrw7-89jp-8q8g","record":{"aliases":["RUSTSEC-2024-0429"],"analysis":{"component_type":"library","fix_type":"patch","impacts":["denial_of_service"],"network_reachable":"unknown","non_default_config":false,"product_category":"Rust glib library","requires_auth":"none","summary":"An unsound pointer mutation in the Rust glib library causes null pointer dereferences and crashes when iterating over VariantStrIter.","user_interaction":"not_required","vuln_class":"null_dereference"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"The `VariantStrIter::impl_get` function (called internally by implementations of the `Iterator` and `DoubleEndedIterator` traits for this type) was unsound, resulting in undefined behaviour.\n\nAn immutable reference `\u0026p` to a `*mut libc::c_char` pointer initialized to `NULL` was passed as an argument to a C function that that mutates the pointer behind `\u0026p` in-place (i.e. as an out-argument), which was unsound. After changes in recent versions of the Rust compiler, these unsound writes through `\u0026p` now seem to be completely disregarded when building the `glib` crate with optimizations.\n\nThis subsequently caused all calls of `VariantStrIter::impl_get` to violate the safety requirements of the `std::ffi::CStr::from_ptr` function - which requires its argument to be a valid pointer to a C-style string - resulting in crashes due to `NULL` pointer dereferences.\n\nThis was fixed by passing the out-argument pointer explitly as `\u0026mut p` instead of `\u0026p`.\n\nThis issue has been present since this code was initially added in `glib` v0.15.0. The mismatch in mutability was likely missed (and not raised as an error by the compiler) because the C function wrapped by `VariantStrIter::impl_get` is variadic (`glib_sys::g_variant_get_child`), and the pointer in question is one of the variadic arguments.","ecosystems":["crates.io"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Unsoundness in `Iterator` and `DoubleEndedIterator` impls for `glib::VariantStrIter`","id":"GHSA-wrw7-89jp-8q8g","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"null_dereference","year":"2024"},"n_packages":3,"n_references":null,"packages":[{"ecosystem":"crates.io","fixed":["0.20.0"],"introduced":["0.15.0"],"last_affected":[],"package":"glib","purl":null,"source":"GHSA-wrw7-89jp-8q8g"},{"ecosystem":"crates.io","fixed":["0.20.0"],"introduced":["0.15.0"],"last_affected":[],"package":"glib","purl":"pkg:cargo/glib","source":"GHSA-wrw7-89jp-8q8g"},{"ecosystem":"crates.io","fixed":["0.20.0"],"introduced":["0.15.0"],"last_affected":[],"package":"glib","purl":"pkg:cargo/glib","source":"RUSTSEC-2024-0429"}],"products":null,"published":"2024-03-30","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"open","licence":"CC0 1.0","name":"RustSec","prefix":"RUSTSEC"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"An unsound pointer mutation in the Rust glib library causes null pointer dereferences and crashes when iterating over VariantStrIter.","url":"https://insights.sbomify.com/GHSA-wrw7-89jp-8q8g/"}