-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Expected Behavior
I would expect the following test to pass in debug mode:
ISOLATE_UNIT_TEST_CASE(String_ScrubName_Null) {
const auto& null_string = String::Handle(String::null());
EXPECT(null_string.IsNull());
EXPECT_STREQ("String: null", null_string.ToCString());
EXPECT_STREQ("String: null", String::ScrubName(null_string));
}Actual Behavior
The test fails due to an assertion error
./xcodebuild/DebugARM64/run_vm_tests String_ScrubName_Null
Running test: String_ScrubName_Null
../../runtime/vm/object.cc: 307: error: expected: strlen(cname) == static_cast<size_t>(name.Length())
version=3.6.2 (stable) (Mon Feb 10 09:36:33 2025 -0600) on "macos_simarm64"
pid=25426, thread=259, isolate_group=isolate(0x118008200), isolate=isolate(0x11800fa00)
os=macos, arch=arm64, comp=no, sim=yes
isolate_instructions=102484d00, vm_instructions=102484d00
fp=16d97a110, sp=16d97a0e0, pc=102d98478
pc 0x0000000102d98478 fp 0x000000016d97a110 dart::Profiler::DumpStackTrace(bool)+0x20
pc 0x0000000102d983e8 fp 0x000000016d97a160 dart::Profiler::DumpStackTrace(void*)+0x28
pc 0x00000001034f7410 fp 0x000000016d97a180 Dart_DumpNativeStackTrace+0x18
pc 0x0000000102a6854c fp 0x000000016d97a1b0 dart::Assert::Fail(char const*, ...) const+0x40
pc 0x0000000102c537b4 fp 0x000000016d97a380 dart::String::ScrubName(dart::String const&, bool)+0xf8
pc 0x00000001026c6374 fp 0x000000016d97a410 dart::Dart_TestHelperString_ScrubName_Null(dart::Thread*)+0xd8
pc 0x00000001026c624c fp 0x000000016d97aba0 dart::Dart_TestString_ScrubName_Null()+0xdc
pc 0x00000001024b3388 fp 0x000000016d97abd0 dart::TestCase::Run()+0x3c
pc 0x00000001024b34c4 fp 0x000000016d97ac20 dart::TestCaseBase::RunTest()+0x64
pc 0x0000000102772260 fp 0x000000016d97ac40 dart::TestCaseBase::RunAll()+0x40
pc 0x00000001024b3bcc fp 0x000000016d97ad60 dart::Main(int, char const**)+0x41c
pc 0x00000001024b37ac fp 0x000000016d97ad80 main+0x24
pc 0x00000001839b20e0 fp 0x000000016d97afb0 start+0x938
-- End of DumpStackTrace
[2] 25426 abort ./xcodebuild/DebugARM64/run_vm_tests String_ScrubName_Null
Is this expected behavior? String::ScrubName has the following assert:
const char* cname = name.ToCString(); // "String: null"
ASSERT(strlen(cname) == static_cast<size_t>(name.Length()));Which is incompatible with the behavior of ToCString() when IsNull() is true:
const char* String::ToCString() const {
if (IsNull()) {
return "String: null";
}
// ...
}Metadata
Metadata
Assignees
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)