Skip to content

Commit

Permalink
Fix an off-by-one error demangling satellite assembly names
Browse files Browse the repository at this point in the history
When assemblies are packaged in the APK archive, their names are
"mangled" so that we don't create clashes with "real" shared libraries,
which are placed in the same directory.  Additionally, since the `lib/`
directory in the APK archive supports only single level of directories,
we must encode satellite assembly culture in the file name, instead of
putting it in a subdirectory.

Unfortunately, when the code was committed, an off-by-one error crept
in, when converting satellite assembly names to their `culture/name`
for.  As the result, the first character of the culture was omitted
which would cause the satellite assemblies not to be loaded properly.

Fix the issue by using the correct mangled name prefix length.
  • Loading branch information
grendello committed Aug 19, 2024
1 parent 07cb311 commit 6c0aa73
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/native/monodroid/embedded-assemblies.hh
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ namespace xamarin::android::internal {
static constexpr size_t get_mangled_prefix_length ()
{
if constexpr (IsSatelliteAssembly) {
// +1 for the extra `-` char in the culture portion of satellite assembly's name;
return SharedConstants::MANGLED_ASSEMBLY_SATELLITE_ASSEMBLY_MARKER.length () + 1;
return SharedConstants::MANGLED_ASSEMBLY_SATELLITE_ASSEMBLY_MARKER.length ();
} else {
return SharedConstants::MANGLED_ASSEMBLY_REGULAR_ASSEMBLY_MARKER.length ();
}
Expand Down

0 comments on commit 6c0aa73

Please sign in to comment.