Description
In versions of ruma-identifiers-validation from 0.2.3 up to, but excluding, 0.13.0, ruma_identifiers_validation::mxc_uri::validate can panic when checking a Matrix content URI. With a long server name, the offset marking its end in the URI can exceed the range of the integer type used by the library.
Potential impact
An application that validates an externally supplied content URI can stop processing the request. If the service is built to abort on panic, other requests are also interrupted.
Remediation
Version 0.13.0 fixes content URI validation. If the application also uses the crate to validate Matrix key IDs, update to 0.14.0 or later to get both fixes.
Examples
This Cargo.toml example selects a version that includes both fixes.
Before
[dependencies]
ruma-identifiers-validation = "=0.12.1"
After
[dependencies]
ruma-identifiers-validation = "0.14.0"
If the application uses Cargo.lock, update the lockfile and rebuild.