Skip to content

Debug bundle from pipeline build is unable to load #7

Description

@pnck
  • Pipeline.Release => OK
  • Pipeline.Debug => FAIL

CleanShot_2024-04-26_at_18 32 36@2x

Reference Info (IDA)

    while ( 1 )
    {
      v76 = v31;
      v32 = v31[7];
      bundleRef = 0LL;
      init_bundleRef(&bundleRef, v32);
      api = (__int64 **)operator new(0x10uLL);
      *api = v69;
      api[1] = 0LL;
      client = get_component_client(&bundleRef, api);
      if ( !client )
      {
        exception = (std::runtime_error *)__cxa_allocate_exception(0x10uLL);
        std::runtime_error::runtime_error(exception, "Component entrypoint returned null interface");
        __cxa_throw(
          exception,
          (struct type_info *)&`typeinfo for'std::runtime_error,
          (void (__fastcall *)(void *))&std::runtime_error::~runtime_error);
      }
      ver = (**(__int64 (__fastcall ***)(void *))client)(client);
      sub_10063BFF0((__int64)v54, (const char *)v76[7]);
      v35 = v77;
      v73 = v77;
      v74 = "";
      memset(v75, 0, 25);
      sub_10005A9A3(
        (void (__fastcall ***)(_QWORD, const char *, size_t))&v73,
        "Component : ",
        (__int64)v54,
        (__int64)" API ",
        (__int64)&ver);
void __fastcall init_bundleRef(CFBundleRef **a1, __int64 a2)
{
  CFBundleRef *v2; // rbx

  sub_1002E0424((void **)a1);
  v2 = (CFBundleRef *)operator new(8uLL);
  load_bundle_(v2, a2);
  *a1 = v2;
}

void __fastcall load_bundle(CFBundleRef *a1, __int64 a2)
{
  void *v2; // r15
  NSString *v3; // rax
  NSString *v4; // r12
  NSURL *v5; // rax
  const __CFURL *v6; // rbx
  std::runtime_error *exception; // rbx

  *a1 = 0LL;
  v2 = objc_autoreleasePoolPush();
  v3 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", a2);
  v4 = objc_retainAutoreleasedReturnValue(v3);
  v5 = +[NSURL fileURLWithPath:](&OBJC_CLASS___NSURL, "fileURLWithPath:", v4);
  v6 = objc_retainAutoreleasedReturnValue(v5);
  *a1 = CFBundleCreate(kCFAllocatorDefault, v6);
  objc_release(v6);
  objc_release(v4);
  objc_autoreleasePoolPop(v2);
  if ( !*a1 )
  {
    exception = (std::runtime_error *)__cxa_allocate_exception(0x10uLL);
    std::runtime_error::runtime_error(exception, "Could not load component");
    __cxa_throw(
      exception,
      (struct type_info *)&`typeinfo for'std::runtime_error,
      (void (__fastcall *)(void *))&std::runtime_error::~runtime_error);
  }
}
void *__fastcall get_component_client(CFBundleRef **a1, void *api)
{
  void *(__fastcall *foobar2000_get_interface)(void *, void *); // rax
  std::runtime_error *exception; // rbx

  foobar2000_get_interface = (void *(__fastcall *)(void *, void *))find_func(*a1, "foobar2000_get_interface");
  if ( !foobar2000_get_interface )
  {
    exception = (std::runtime_error *)__cxa_allocate_exception(0x10uLL);
    std::runtime_error::runtime_error(exception, "Component entrypoint inaccessible");
    __cxa_throw(
      exception,
      (struct type_info *)&`typeinfo for'std::runtime_error,
      (void (__fastcall *)(void *))&std::runtime_error::~runtime_error);
  }
  return foobar2000_get_interface(api, **a1);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions