Daniel Shahaf wrote:
> Bert Huijben wrote on Sun, 16 Nov 2008 at 13:47 +0100:
>>> svn_checksum_to_cstring_display(checked_checksum,
>>> trail->pool));
>>> }
>> This last line gives
>> f:\svn-2008\dev\subversion\libsvn_fs_base\reps-strings.c(926) : warning C4700: uninitialized local variable 'checked_checksum' used
>>
>> (See also the buildbot output)
>>
>> This patch removes all possible initializations of checked_checksum, but
>> starts using it in this error message.
>>
>
> Still present in current trunk; the code reads:
>
> if (args->rb->offset == args->rb->size)
> {
> representation_t *rep;
> svn_checksum_t *checked_checksum;
>
> svn_checksum_final(&args->rb->md5_checksum,
> args->rb->md5_checksum_ctx, trail->pool);
> svn_checksum_final(&args->rb->sha1_checksum,
> args->rb->sha1_checksum_ctx, trail->pool);
> args->rb->checksum_finalized = TRUE;
>
> SVN_ERR(svn_fs_bdb__read_rep(&rep, args->rb->fs,
> args->rb->rep_key,
> trail, trail->pool));
>
> if (rep->md5_checksum
> && (! svn_checksum_match(rep->md5_checksum,
> args->rb->md5_checksum)))
> return svn_error_createf
> (SVN_ERR_FS_CORRUPT, NULL,
> _("MD5 checksum mismatch on rep '%s':\n"
> " expected: %s\n"
> " actual: %s\n"), args->rb->rep_key,
> svn_checksum_to_cstring_display(rep->md5_checksum,
> trail->pool),
> svn_checksum_to_cstring_display(checked_checksum,
>
> which might segfault (because checked_checksum is not initialized) if the
> MD5 ever mismatches.
The same problem existed with the sha1 mismatch as well. r34935 should fix it.
Is there a reason we use *both* the sha1 and md5 checksums for data integrity
checking here? It would seem that one is sufficient, which is what we currently
do in the FSFS backend.
-Hyrum
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=992952
Received on 2008-12-26 15:47:00 CET