Skip to content

Commit bad29fb

Browse files
committed
Rephrased comments to reflect the fixed bug. Removed references to
specific line numbers.
1 parent 9691fe6 commit bad29fb

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

tests/test_editAlgorithm.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,18 +2131,19 @@ main(int argc, char** argv)
21312131
TimeRange(RationalTime(0.0, 24.0), RationalTime(10.0, 24.0)) });
21322132
});
21332133

2134-
// Null Pointer Dereference from Unchecked dynamic_cast
2134+
// Regression Test: Null Pointer Dereference from Unchecked dynamic_cast
21352135
//
21362136
// The editAlgorithm functions call dynamic_cast<Item*>(item->clone()) and
2137-
// immediately dereference the result. SerializableObject::clone() can
2137+
// _used to_ immediately dereference the result.
2138+
// SerializableObject::clone() can
21382139
// return nullptr (for example, when the object's metadata contains a
21392140
// cycle, which causes the cloning encoder to error out). When that
21402141
// happens, the dynamic_cast also yields nullptr and the next member call
2141-
// is a null pointer dereference (denial of service / crash).
2142+
// _used to_ dereference the null pointer (denial of service / crash).
21422143
//
21432144
// The tests below construct Items whose metadata contains a cycle (the
21442145
// clip references itself) and exercise each of the four affected call
2145-
// sites. After the fix, the algorithms must not crash and must report a
2146+
// sites. After the fix, the algorithms does not crash and reports a
21462147
// non-OK error status rather than dereferencing nullptr.
21472148
//
21482149
// Helper: make a clip whose clone() will fail because of a metadata cycle.
@@ -2163,7 +2164,7 @@ main(int argc, char** argv)
21632164
return clip;
21642165
};
21652166

2166-
// Line 185: overwrite() splits a single clip whose middle is overwritten.
2167+
// overwrite() splits a single clip whose middle is overwritten.
21672168
tests.add_test("test_edit_overwrite_null_clone_safe", [&] {
21682169
auto clip = make_clip_with_cyclic_metadata(
21692170
"cyclic",
@@ -2179,7 +2180,7 @@ main(int argc, char** argv)
21792180
OTIO_NS::ErrorStatus error_status;
21802181
// Overwrite a 4-frame range in the middle of the cyclic clip. This
21812182
// forces the code path that clones items.front() to produce the
2182-
// trailing slice (line 185).
2183+
// trailing slice.
21832184
algo::overwrite(
21842185
insert_clip,
21852186
track,
@@ -2191,7 +2192,7 @@ main(int argc, char** argv)
21912192
assertTrue(is_error(error_status));
21922193
});
21932194

2194-
// Line 367: insert() splits an existing clip and clones it for the tail.
2195+
// insert() splits an existing clip and clones it for the tail.
21952196
tests.add_test("test_edit_insert_null_clone_safe", [&] {
21962197
auto clip = make_clip_with_cyclic_metadata(
21972198
"cyclic",
@@ -2215,7 +2216,7 @@ main(int argc, char** argv)
22152216
assertTrue(is_error(error_status));
22162217
});
22172218

2218-
// Line 534: slice() clones an item to create the second slice.
2219+
// slice() clones an item to create the second slice.
22192220
tests.add_test("test_edit_slice_null_clone_safe", [&] {
22202221
auto clip = make_clip_with_cyclic_metadata(
22212222
"cyclic",
@@ -2228,7 +2229,7 @@ main(int argc, char** argv)
22282229
assertTrue(is_error(error_status));
22292230
});
22302231

2231-
// Line 795: fill() clones the source item before placing it on the track.
2232+
// fill() clones the source item before placing it on the track.
22322233
tests.add_test("test_edit_fill_null_clone_safe", [&] {
22332234
// Track with a gap so that fill() can find a slot to fill.
22342235
SerializableObject::Retainer<Gap> gap = new Gap(

0 commit comments

Comments
 (0)