Skip to content

SIGABRT crash on Android 14+ (API 34+): NewStringUTF called with non-Modified-UTF-8 ARCore anchor ID in ARUtilsCreateJavaARAnchorFromAnchor #472

@LeoBessin

Description

@LeoBessin

Environment

  • Package: @reactvision/react-viro
  • Platform: Android 14+ (API 34+)
  • Architecture: arm64-v8a
  • Affected file: viro_renderer-release.aarjni/arm64-v8a/libviro_renderer.so

Summary

On Android 14+ (API 34+), the app crashes with a SIGABRT during AR anchor
creation. The crash occurs inside ARUtilsCreateJavaARAnchorFromAnchor at
file offset 0x55E5EC in libviro_renderer.so.

This issue was identified and analyzed with the help of Claude (Anthropic),
which traced the binary-level root cause and proposed both a workaround and a
proper fix.


Root Cause

The native function ARUtilsCreateJavaARAnchorFromAnchor calls
env->NewStringUTF(anchorId) where anchorId is the raw byte string returned
by ARCore for the anchor's identifier.

Starting with Android 14 (API 34), ART's strict JNI enforcement was
significantly tightened. NewStringUTF now aborts the process if the
provided byte string contains any bytes that are not valid
Modified UTF-8.
ARCore anchor IDs are arbitrary opaque byte strings and are not guaranteed to
be valid Modified UTF-8, which triggers this abort.

The resulting crash in logcat looks like:

A/libc: Fatal signal 6 (SIGABRT) 
backtrace:
#00  ARUtilsCreateJavaARAnchorFromAnchor + 212

The anchor ID is only used inside Viro's Java layer to populate
ARAnchor.mAnchorId. It is never exposed to the JavaScript layer in typical
usage, so passing null or a sanitized replacement does not affect AR
functionality.


Steps to Reproduce

  1. Use @reactvision/react-viro with AR features (e.g. ViroARScene with
    anchor tracking)
  2. Run on a physical device with Android 14+ (API 34+)
  3. Trigger AR anchor creation (e.g. place an object, detect a surface)
  4. The app crashes immediately with SIGABRT

References
Android 14 JNI changes — stricter NewStringUTF validation
JNI Tips — Modified UTF-8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions