Skip to content

Commit e74da7c

Browse files
[Mono] Fix uninitialized vtable bug (#67746)
Fixes #67402 The code which checks whether a class derived from System.IO.Stream has overridden certain methods didn't explicitly setup the vtable before it tried to dereference the vtable pointer. When AOT was enabled the vtable pointer was null and dereferencing it caused a crash.
1 parent 538934c commit e74da7c

File tree

18 files changed

+135
-18
lines changed

18 files changed

+135
-18
lines changed

src/libraries/Common/tests/StreamConformanceTests/System/IO/StreamConformanceTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ public abstract class StandaloneStreamConformanceTests : StreamConformanceTests
711711
}
712712

713713
[Fact]
714+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
714715
public virtual async Task ArgumentValidation_ThrowsExpectedException()
715716
{
716717
await foreach (Stream? stream in GetStreamsForValidation())
@@ -724,6 +725,7 @@ public virtual async Task ArgumentValidation_ThrowsExpectedException()
724725
}
725726

726727
[Fact]
728+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
727729
public virtual async Task Disposed_ThrowsObjectDisposedException()
728730
{
729731
await foreach (Stream? stream in GetStreamsForValidation())
@@ -788,6 +790,7 @@ public virtual async Task Write_Nop_Success(ReadWriteMode mode)
788790
[InlineData(ReadWriteMode.SyncArray)]
789791
[InlineData(ReadWriteMode.AsyncArray)]
790792
[InlineData(ReadWriteMode.AsyncAPM)]
793+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
791794
public virtual async Task Read_DataStoredAtDesiredOffset(ReadWriteMode mode)
792795
{
793796
const byte Expected = 42;
@@ -1596,6 +1599,7 @@ protected static bool Bidirectional(StreamPair streams) =>
15961599
streams.Stream2.CanRead && streams.Stream2.CanWrite;
15971600

15981601
[Fact]
1602+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
15991603
public virtual async Task ArgumentValidation_ThrowsExpectedException()
16001604
{
16011605
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1607,6 +1611,7 @@ public virtual async Task ArgumentValidation_ThrowsExpectedException()
16071611
}
16081612

16091613
[Fact]
1614+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
16101615
public virtual async Task Disposed_ThrowsObjectDisposedException()
16111616
{
16121617
StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1619,6 +1624,7 @@ public virtual async Task Disposed_ThrowsObjectDisposedException()
16191624
}
16201625

16211626
[Fact]
1627+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
16221628
public virtual async Task ReadWriteAsync_PrecanceledOperations_ThrowsCancellationException()
16231629
{
16241630
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1630,6 +1636,7 @@ public virtual async Task ReadWriteAsync_PrecanceledOperations_ThrowsCancellatio
16301636
}
16311637

16321638
[Fact]
1639+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
16331640
public virtual async Task ReadAsync_CancelPendingTask_ThrowsCancellationException()
16341641
{
16351642
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1639,6 +1646,7 @@ public virtual async Task ReadAsync_CancelPendingTask_ThrowsCancellationExceptio
16391646
}
16401647

16411648
[Fact]
1649+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
16421650
public virtual async Task ReadAsync_CancelPendingValueTask_ThrowsCancellationException()
16431651
{
16441652
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1648,6 +1656,7 @@ public virtual async Task ReadAsync_CancelPendingValueTask_ThrowsCancellationExc
16481656
}
16491657

16501658
[Fact]
1659+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
16511660
public virtual async Task ReadWriteByte_Success()
16521661
{
16531662
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1720,6 +1729,7 @@ public virtual async Task ReadWrite_Success_Large(ReadWriteMode mode, int writeS
17201729

17211730
[Theory]
17221731
[MemberData(nameof(ReadWrite_Success_MemberData))]
1732+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
17231733
public virtual async Task ReadWrite_Success(ReadWriteMode mode, int writeSize, bool startWithFlush)
17241734
{
17251735
foreach (CancellationToken nonCanceledToken in new[] { CancellationToken.None, new CancellationTokenSource().Token })
@@ -1776,6 +1786,7 @@ public virtual async Task ReadWrite_Success(ReadWriteMode mode, int writeSize, b
17761786

17771787
[Theory]
17781788
[MemberData(nameof(ReadWrite_Modes))]
1789+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
17791790
public virtual async Task ReadWrite_MessagesSmallerThanReadBuffer_Success(ReadWriteMode mode)
17801791
{
17811792
if (!FlushGuaranteesAllDataWritten)
@@ -1824,6 +1835,7 @@ public virtual async Task ReadWrite_MessagesSmallerThanReadBuffer_Success(ReadWr
18241835
[Theory]
18251836
[MemberData(nameof(AllReadWriteModesAndValue), false)]
18261837
[MemberData(nameof(AllReadWriteModesAndValue), true)]
1838+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
18271839
public virtual async Task Read_Eof_Returns0(ReadWriteMode mode, bool dataAvailableFirst)
18281840
{
18291841
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1862,6 +1874,7 @@ public virtual async Task Read_Eof_Returns0(ReadWriteMode mode, bool dataAvailab
18621874
[InlineData(ReadWriteMode.SyncArray)]
18631875
[InlineData(ReadWriteMode.AsyncArray)]
18641876
[InlineData(ReadWriteMode.AsyncAPM)]
1877+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
18651878
public virtual async Task Read_DataStoredAtDesiredOffset(ReadWriteMode mode)
18661879
{
18671880
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1891,6 +1904,7 @@ public virtual async Task Read_DataStoredAtDesiredOffset(ReadWriteMode mode)
18911904
[InlineData(ReadWriteMode.SyncArray)]
18921905
[InlineData(ReadWriteMode.AsyncArray)]
18931906
[InlineData(ReadWriteMode.AsyncAPM)]
1907+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
18941908
public virtual async Task Write_DataReadFromDesiredOffset(ReadWriteMode mode)
18951909
{
18961910
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -1989,6 +2003,7 @@ public static IEnumerable<object[]> ReadAsync_ContinuesOnCurrentContextIfDesired
19892003

19902004
[Theory]
19912005
[MemberData(nameof(ReadAsync_ContinuesOnCurrentContextIfDesired_MemberData))]
2006+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
19922007
public virtual async Task ReadAsync_ContinuesOnCurrentSynchronizationContextIfDesired(bool flowExecutionContext, bool? continueOnCapturedContext)
19932008
{
19942009
await default(JumpToThreadPoolAwaiter); // escape xunit sync ctx
@@ -2071,6 +2086,7 @@ public virtual async Task ReadAsync_ContinuesOnCurrentSynchronizationContextIfDe
20712086

20722087
[Theory]
20732088
[MemberData(nameof(ReadAsync_ContinuesOnCurrentContextIfDesired_MemberData))]
2089+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
20742090
public virtual async Task ReadAsync_ContinuesOnCurrentTaskSchedulerIfDesired(bool flowExecutionContext, bool? continueOnCapturedContext)
20752091
{
20762092
await default(JumpToThreadPoolAwaiter); // escape xunit sync ctx
@@ -2160,6 +2176,7 @@ await Task.Factory.StartNew(() =>
21602176
[InlineData(ReadWriteMode.AsyncMemory)]
21612177
[InlineData(ReadWriteMode.SyncAPM)]
21622178
[InlineData(ReadWriteMode.AsyncAPM)]
2179+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
21632180
public virtual async Task ZeroByteRead_BlocksUntilDataAvailableOrNops(ReadWriteMode mode)
21642181
{
21652182
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -2226,6 +2243,7 @@ public virtual async Task ZeroByteRead_BlocksUntilDataAvailableOrNops(ReadWriteM
22262243
[InlineData(ReadWriteMode.AsyncMemory)]
22272244
[InlineData(ReadWriteMode.SyncAPM)]
22282245
[InlineData(ReadWriteMode.AsyncAPM)]
2246+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
22292247
public virtual async Task ZeroByteWrite_OtherDataReceivedSuccessfully(ReadWriteMode mode)
22302248
{
22312249
byte[][] buffers = new[] { Array.Empty<byte>(), Encoding.UTF8.GetBytes("hello"), Array.Empty<byte>(), Encoding.UTF8.GetBytes("world") };
@@ -2279,6 +2297,7 @@ public virtual async Task ZeroByteWrite_OtherDataReceivedSuccessfully(ReadWriteM
22792297
[Theory]
22802298
[InlineData(false)]
22812299
[InlineData(true)]
2300+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
22822301
public virtual async Task ReadWrite_CustomMemoryManager_Success(bool useAsync)
22832302
{
22842303
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -2399,6 +2418,7 @@ public virtual async Task CopyToAsync_AllDataCopied_Large(bool useAsync) =>
23992418

24002419
[Theory]
24012420
[MemberData(nameof(CopyToAsync_AllDataCopied_MemberData))]
2421+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
24022422
public virtual async Task CopyToAsync_AllDataCopied(int byteCount, bool useAsync)
24032423
{
24042424
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -2436,6 +2456,7 @@ await Task.WhenAll(Enumerable.Range(0, 20).Select(_ => Task.Run(async () =>
24362456
}
24372457

24382458
[Fact]
2459+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
24392460
public virtual async Task Timeout_Roundtrips()
24402461
{
24412462
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -2470,6 +2491,7 @@ public virtual async Task Timeout_Roundtrips()
24702491
}
24712492

24722493
[Fact]
2494+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
24732495
public virtual async Task ReadTimeout_Expires_Throws()
24742496
{
24752497
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -2604,6 +2626,7 @@ public virtual async Task ReadAsync_DuringReadAsync_ThrowsIfUnsupported()
26042626
}
26052627

26062628
[Fact]
2629+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
26072630
public virtual async Task Flush_ValidOnWriteableStreamWithNoData_Success()
26082631
{
26092632
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -2618,6 +2641,7 @@ public virtual async Task Flush_ValidOnWriteableStreamWithNoData_Success()
26182641
}
26192642

26202643
[Fact]
2644+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
26212645
public virtual async Task Flush_ValidOnReadableStream_Success()
26222646
{
26232647
using StreamPair streams = await CreateConnectedStreamsAsync();
@@ -2635,6 +2659,7 @@ public virtual async Task Flush_ValidOnReadableStream_Success()
26352659
[InlineData(0)]
26362660
[InlineData(1)]
26372661
[InlineData(2)]
2662+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
26382663
public virtual async Task Dispose_ClosesStream(int disposeMode)
26392664
{
26402665
if (!CansReturnFalseAfterDispose)

src/libraries/System.IO.FileSystem/tests/Base/FileGetSetAttributes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public void SettingInvalidAttributes_Unix(FileAttributes attributes)
6565
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsCaseSensitiveOS))]
6666
[InlineData(FileAttributes.Hidden)]
6767
[PlatformSpecific(TestPlatforms.AnyUnix & ~(TestPlatforms.OSX | TestPlatforms.FreeBSD))]
68+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
6869
public void SettingInvalidAttributes_UnixExceptOSXAndFreeBSD(FileAttributes attributes)
6970
{
7071
string path = CreateItem();

src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ public void DriveLetter_Windows()
468468

469469
[Fact]
470470
[PlatformSpecific(TestPlatforms.AnyUnix)] // drive letters casing
471+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
471472
public void DriveLetter_Unix()
472473
{
473474
// On Unix, there's no special casing for drive letters. These may or may not be valid names, depending

src/libraries/System.IO.FileSystem/tests/Directory/Delete.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public void DeletingSymLinkDoesntDeleteTarget()
120120
}
121121

122122
[ConditionalFact(nameof(UsingNewNormalization))]
123+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
123124
public void ExtendedDirectoryWithSubdirectories()
124125
{
125126
DirectoryInfo testDir = Directory.CreateDirectory(IOInputs.ExtendedPrefix + GetTestFilePath());
@@ -129,6 +130,7 @@ public void ExtendedDirectoryWithSubdirectories()
129130
}
130131

131132
[ConditionalFact(nameof(LongPathsAreNotBlocked), nameof(UsingNewNormalization))]
133+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
132134
public void LongPathExtendedDirectory()
133135
{
134136
DirectoryInfo testDir = Directory.CreateDirectory(IOServices.GetPath(IOInputs.ExtendedPrefix + TestDirectory, characterCount: 500));

src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ public void ExtendedPathAlreadyExistsAsFile()
394394

395395
[Fact]
396396
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Makes call to native code (libc)
397+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
397398
public void FalseForNonRegularFile()
398399
{
399400
string fileName = GetTestFilePath();

src/libraries/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str_str.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ public void WindowsSearchPatternWhitespace()
698698
}
699699

700700
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsCaseSensitiveOS))]
701+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
701702
public void SearchPatternCaseSensitive()
702703
{
703704
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());

src/libraries/System.IO.FileSystem/tests/Directory/GetLogicalDrives.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class Directory_GetLogicalDrives
1111
{
1212
[Fact]
1313
[PlatformSpecific(TestPlatforms.AnyUnix)] // Valid drive strings on Unix
14+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
1415
public void GetsValidDriveStrings_Unix()
1516
{
1617
string[] drives = Directory.GetLogicalDrives();

src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Exists.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public void FalseForFile()
109109

110110
[Fact]
111111
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Uses P/Invokes
112+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
112113
public void FalseForNonRegularFile()
113114
{
114115
string fileName = GetTestFilePath();

src/libraries/System.IO.FileSystem/tests/File/Exists.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ public void PathAlreadyExistsAsDirectory()
255255

256256
[Fact]
257257
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Uses P/Invokes
258+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
258259
public void FalseForNonRegularFile()
259260
{
260261
string fileName = GetTestFilePath();

src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static async Task WaitConnectionAndWritePipeStreamAsync(NamedPipeServerStream na
195195

196196
[Fact]
197197
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)]
198+
[ActiveIssue("https://github.com/dotnet/runtime/issues/67853", TestPlatforms.tvOS)]
198199
public async Task ReadAllBytes_NonSeekableFileStream_InUnix()
199200
{
200201
string fifoPath = GetTestFilePath();

0 commit comments

Comments
 (0)