SkString.cpp fatal error: "check(safe.ok())" after vcpkg update

18 views
Skip to first unread message

Ionut Cosmin Mihai

unread,
Jun 13, 2025, 4:05:57 PM6/13/25
to skia-discuss
Hi,
I'm getting the following error when trying to create a shader (This was working before updating vcpkg to the latest version):

SkString.cpp:229: fatal error: "check(safe.ok())"

These are the arguments I'm building with:
    bin/gn gen \
        ../PB/third-party/osx/skia/arm64 \
        --ide=xcode \
        --args="is_official_build=true \
            is_trivial_abi=false \
            is_debug=false \
            target_cpu=\"arm64\" \
            skia_enable_svg=true \
            skia_use_vulkan=true \
            skia_use_system_zlib=false \
            skia_use_system_harfbuzz=false \
            skia_use_system_libjpeg_turbo=false \
            skia_use_system_libpng=false \
            skia_use_system_libwebp=false \
            skia_use_system_expat=false \
            skia_use_system_icu=false \
            extra_cflags_cc=[\"-frtti\"]"

The function that I call(skslCode is a string containing the shader):
auto skString = SkString(skslCode);
SkRuntimeEffect::MakeForShader(skString)

This is the problematic function(assert fails at SkASSERT_RELEASE(safe.ok());):
sk_sp<SkString::Rec> SkString::Rec::Make(const char text[], size_t len) {
    if (0 == len) {
        return sk_sp<SkString::Rec>(const_cast<Rec*>(&gEmptyRec));
    }

    SkSafeMath safe;
    // We store a 32bit version of the length
    uint32_t stringLen = safe.castTo<uint32_t>(len);
    // Add SizeOfRec() for our overhead and 1 for null-termination
    size_t allocationSize = safe.add(len, SizeOfRec() + sizeof(char));
    // Align up to a multiple of 4
    allocationSize = safe.alignUp(allocationSize, 4);

    SkASSERT_RELEASE(safe.ok());

    void* storage = ::operator new (allocationSize);
    sk_sp<Rec> rec(new (storage) Rec(stringLen, 1));
    if (text) {
        memcpy(rec->data(), text, len);
    }
    rec->data()[len] = 0;
    return rec;
}

Any idea what might be the cause or what could influence it? It makes no sense to me. Thank you!
Reply all
Reply to author
Forward
0 new messages