Skip to content

Commit 1fb62ff

Browse files
authored
fix v0 replay sync and a crash that occurs at the end of playback (#18347)
1 parent ff7b84b commit 1fb62ff

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

input/bsv/bsvmovie.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ bool bsv_movie_reset_playback(bsv_movie_t *handle)
126126
if (!bsv_movie_load_checkpoint(handle, compression, encoding, REPLAY_CPBEHAVIOR_DESERIALIZE))
127127
return false;
128128
}
129-
if(vsn == 0)
130-
return true;
131129
return bsv_movie_read_next_events(handle, REPLAY_CPBEHAVIOR_DESERIALIZE, true);
132130
}
133131

@@ -722,6 +720,12 @@ bool bsv_movie_read_next_events(bsv_movie_t *handle, replay_checkpoint_behavior
722720
if (!bsv_movie_load_checkpoint(handle, compression, encoding, checkpoint_behavior))
723721
RARCH_WARN("[Replay] Failed to load movie checkpoint\n");
724722
}
723+
else if (next_frame_type != REPLAY_TOKEN_REGULAR_FRAME)
724+
{
725+
RARCH_ERR("[Replay] Invalid replay token 0x%x\n", next_frame_type);
726+
if (end_movie)
727+
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_END;
728+
}
725729
}
726730
return true;
727731
}

input/bsv/uint32s_index.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ void uint32s_index_clear(uint32s_index_t *index)
323323
void uint32s_index_free(uint32s_index_t *index)
324324
{
325325
size_t i, cap;
326+
if (!index)
327+
return;
326328
for(i = 0, cap = RHMAP_CAP(index->index); i != cap; i++)
327329
if(RHMAP_KEY(index->index, i))
328330
uint32s_bucket_free(&index->index[i]);
@@ -351,6 +353,8 @@ void uint32s_index_print_count_data(uint32s_index_t *index)
351353
/* TODO: don't count or differently count NULL objects entries */
352354
uint32_t max=1;
353355
uint32_t i;
356+
if (!index)
357+
return;
354358
for(i = 0; i < BIN_COUNT; i++)
355359
bins[i] = 0;
356360
for(i = 1; i < RBUF_LEN(index->counts); i++)

0 commit comments

Comments
 (0)