Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crashes in test6 #177

Merged
merged 2 commits into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions test/mux/test6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ int main(int /*argc*/, char **/*argv*/)
KaxContentEncryption &cencryption = GetChild<KaxContentEncryption>(cencoding);
GetChild<KaxContentEncAlgo>(cencryption).SetValue(14);
GetChild<KaxContentEncKeyID>(cencryption).CopyBuffer((const binary *)"hello2", 6);
GetChild<KaxContentSigAlgo>(cencryption).SetValue(15);
GetChild<KaxContentSigHashAlgo>(cencryption).SetValue(16);
GetChild<KaxContentSigKeyID>(cencryption).CopyBuffer((const binary *)"hello3", 6);
GetChild<KaxContentSignature>(cencryption).CopyBuffer((const binary *)"hello4", 6);
// GetChild<KaxContentSigAlgo>(cencryption).SetValue(15);
// GetChild<KaxContentSigHashAlgo>(cencryption).SetValue(16);
// GetChild<KaxContentSigKeyID>(cencryption).CopyBuffer((const binary *)"hello3", 6);
// GetChild<KaxContentSignature>(cencryption).CopyBuffer((const binary *)"hello4", 6);

// audio specific params
KaxTrackAudio & MyTrack1Audio = GetChild<KaxTrackAudio>(MyTrack1);
Expand All @@ -128,14 +128,14 @@ int main(int /*argc*/, char **/*argv*/)
MyTrack1Freq.SetValue(44100.0);
MyTrack1Freq.ValidateSize();

KaxAudioPosition & MyTrack1Pos = GetChild<KaxAudioPosition>(MyTrack1Audio);
binary *_Pos = new binary[5];
_Pos[0] = '0';
_Pos[1] = '1';
_Pos[2] = '2';
_Pos[3] = '3';
_Pos[4] = '\0';
MyTrack1Pos.SetBuffer(_Pos, 5);
// KaxAudioPosition & MyTrack1Pos = GetChild<KaxAudioPosition>(MyTrack1Audio);
// binary *_Pos = new binary[5];
// _Pos[0] = '0';
// _Pos[1] = '1';
// _Pos[2] = '2';
// _Pos[3] = '3';
// _Pos[4] = '\0';
// MyTrack1Pos.SetBuffer(_Pos, 5);

KaxAudioChannels & MyTrack1Channels = GetChild<KaxAudioChannels>(MyTrack1Audio);
MyTrack1Channels.SetValue(2);
Expand Down Expand Up @@ -218,7 +218,7 @@ int main(int /*argc*/, char **/*argv*/)
KaxBlockBlob *Blob2 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob2->SetBlockGroup(*MyNewBlock);
AllCues.AddBlockBlob(*Blob2);

#if 0 // bogus ownership
// frame with a past reference
DataBuffer *data4 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
Clust1.AddFrame(MyTrack1, 300 * TIMESTAMP_SCALE, *data4, MyNewBlock, *MyLastBlockTrk1);
Expand All @@ -238,7 +238,7 @@ int main(int /*argc*/, char **/*argv*/)
Blob3->SetBlockGroup(*MyLastBlockTrk1);
AllCues.AddBlockBlob(*Blob3);
//AllCues.UpdateSize();

#endif
// simulate the writing of the stream :
// - write an empty element with enough size for the cue entry
// - write the cluster(s)
Expand All @@ -254,7 +254,11 @@ int main(int /*argc*/, char **/*argv*/)
Clust2.EnableChecksum();

DataBuffer *data2 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
#if 0 // bogus ownership
Clust2.AddFrame(MyTrack1, 350 * TIMESTAMP_SCALE, *data2, MyNewBlock, *MyLastBlockTrk1);
#else
Clust2.AddFrame(MyTrack1, 350 * TIMESTAMP_SCALE, *data2, MyNewBlock);
#endif

KaxBlockBlob *Blob4 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob4->SetBlockGroup(*MyNewBlock);
Expand Down Expand Up @@ -344,10 +348,12 @@ int main(int /*argc*/, char **/*argv*/)

out_file.close();

#if 0 // bogus ownership
delete Blob1;
delete Blob2;
delete Blob3;
delete Blob4;
#endif
}
catch (exception & Ex)
{
Expand Down