deltas: Allow processing of empty delta parts

If a static delta is generated between 2 commits with the same content,
then the delta will contain 1 part with no checksums. While useless,
this is a valid delta that shouldn't raise an assertion. If the delta
part has no checksums, then there are no objects to recreate and the
processing can be skipped.

Closes: #420
Approved by: cgwalters
This commit is contained in:
Dan Nicholson 2016-07-30 10:14:17 -05:00 committed by Atomic Bot
parent edecae06ab
commit 512090785e
2 changed files with 8 additions and 3 deletions

View File

@ -42,8 +42,7 @@ _ostree_static_delta_parse_checksum_array (GVariant *array,
n_checksums = n / OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN;
if (G_UNLIKELY(n == 0 ||
n > (G_MAXUINT32/OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN) ||
if (G_UNLIKELY(n > (G_MAXUINT32/OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN) ||
(n_checksums * OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN) != n))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,

View File

@ -210,8 +210,14 @@ _ostree_static_delta_part_execute (OstreeRepo *repo,
error))
goto out;
/* Skip processing for empty delta part */
if (state->n_checksums == 0)
{
ret = TRUE;
goto out;
}
state->checksums = checksums_data;
g_assert (state->n_checksums > 0);
g_variant_get (part, "(@a(uuu)@aa(ayay)@ay@ay)",
&mode_dict,