Skip to content

Commit cff8450

Browse files
committed
Rephrased comments to reflect the fixed bug. Removed references to
specific line numbers.
1 parent d7bb442 commit cff8450

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
@@ -3078,18 +3078,19 @@ main(int argc, char** argv)
30783078
});
30793079
});
30803080

3081-
// Null Pointer Dereference from Unchecked dynamic_cast
3081+
// Regression Test: Null Pointer Dereference from Unchecked dynamic_cast
30823082
//
30833083
// The editAlgorithm functions call dynamic_cast<Item*>(item->clone()) and
3084-
// immediately dereference the result. SerializableObject::clone() can
3084+
// _used to_ immediately dereference the result.
3085+
// SerializableObject::clone() can
30853086
// return nullptr (for example, when the object's metadata contains a
30863087
// cycle, which causes the cloning encoder to error out). When that
30873088
// happens, the dynamic_cast also yields nullptr and the next member call
3088-
// is a null pointer dereference (denial of service / crash).
3089+
// _used to_ dereference the null pointer (denial of service / crash).
30893090
//
30903091
// The tests below construct Items whose metadata contains a cycle (the
30913092
// clip references itself) and exercise each of the four affected call
3092-
// sites. After the fix, the algorithms must not crash and must report a
3093+
// sites. After the fix, the algorithms does not crash and reports a
30933094
// non-OK error status rather than dereferencing nullptr.
30943095
//
30953096
// Helper: make a clip whose clone() will fail because of a metadata cycle.
@@ -3111,7 +3112,7 @@ main(int argc, char** argv)
31113112
return clip;
31123113
};
31133114

3114-
// Line 185: overwrite() splits a single clip whose middle is overwritten.
3115+
// overwrite() splits a single clip whose middle is overwritten.
31153116
tests.add_test("test_edit_overwrite_null_clone_safe", [&] {
31163117
auto clip = make_clip_with_cyclic_metadata(
31173118
"cyclic",
@@ -3127,7 +3128,7 @@ main(int argc, char** argv)
31273128
OTIO_NS::ErrorStatus error_status;
31283129
// Overwrite a 4-frame range in the middle of the cyclic clip. This
31293130
// forces the code path that clones items.front() to produce the
3130-
// trailing slice (line 185).
3131+
// trailing slice.
31313132
algo::overwrite(
31323133
insert_clip,
31333134
track,
@@ -3139,7 +3140,7 @@ main(int argc, char** argv)
31393140
assertTrue(is_error(error_status));
31403141
});
31413142

3142-
// Line 367: insert() splits an existing clip and clones it for the tail.
3143+
// insert() splits an existing clip and clones it for the tail.
31433144
tests.add_test("test_edit_insert_null_clone_safe", [&] {
31443145
auto clip = make_clip_with_cyclic_metadata(
31453146
"cyclic",
@@ -3163,7 +3164,7 @@ main(int argc, char** argv)
31633164
assertTrue(is_error(error_status));
31643165
});
31653166

3166-
// Line 534: slice() clones an item to create the second slice.
3167+
// slice() clones an item to create the second slice.
31673168
tests.add_test("test_edit_slice_null_clone_safe", [&] {
31683169
auto clip = make_clip_with_cyclic_metadata(
31693170
"cyclic",
@@ -3180,7 +3181,7 @@ main(int argc, char** argv)
31803181
assertTrue(is_error(error_status));
31813182
});
31823183

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

0 commit comments

Comments
 (0)