On Mon, May 23, 2011 at 08:39:39PM -0000, s...@apache.org wrote: > Author: stsp > Date: Mon May 23 20:39:38 2011 > New Revision: 1126731 > > URL: http://svn.apache.org/viewvc?rev=1126731&view=rev > Log: > * subversion/libsvn_wc/update_editor.c > (window_handler): If closing the checksum stream fails for some reason > do not try to dereference the hb->actual_source_checksum pointer since > it may be NULL.
Just a note that this problem isn't as severe as it may sound: I found this while playing around with compressed pristines. Because the checksum stream wrapped a compressed stream, if decompression failed an error was thrown before the checksum close handler could generate a checksum. The assumption that a checksum is generated even if an error is thrown from the close handler was a bug which never triggered with the current trunk code. > Modified: > subversion/trunk/subversion/libsvn_wc/update_editor.c > > Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1126731&r1=1126730&r2=1126731&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_wc/update_editor.c (original) > +++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon May 23 20:39:38 > 2011 > @@ -882,21 +882,24 @@ window_handler(svn_txdelta_window_t *win > /* Close the stream to calculate HB->actual_source_md5_checksum. */ > svn_error_t *err2 = svn_stream_close(hb->source_checksum_stream); > > - SVN_ERR_ASSERT(hb->expected_source_checksum->kind == > - hb->actual_source_checksum->kind); > - > - if (!err2 && !svn_checksum_match(hb->expected_source_checksum, > - hb->actual_source_checksum)) > + if (!err2) > { > - err = svn_error_createf(SVN_ERR_WC_CORRUPT_TEXT_BASE, err, > - _("Checksum mismatch while updating '%s':\n" > - " expected: %s\n" > - " actual: %s\n"), > - svn_dirent_local_style(fb->local_abspath, hb->pool), > - svn_checksum_to_cstring(hb->expected_source_checksum, > - hb->pool), > - svn_checksum_to_cstring(hb->actual_source_checksum, > - hb->pool)); > + SVN_ERR_ASSERT(hb->expected_source_checksum->kind == > + hb->actual_source_checksum->kind); > + > + if (!svn_checksum_match(hb->expected_source_checksum, > + hb->actual_source_checksum)) > + { > + err = svn_error_createf(SVN_ERR_WC_CORRUPT_TEXT_BASE, err, > + _("Checksum mismatch while updating '%s':\n" > + " expected: %s\n" > + " actual: %s\n"), > + svn_dirent_local_style(fb->local_abspath, hb->pool), > + svn_checksum_to_cstring(hb->expected_source_checksum, > + hb->pool), > + svn_checksum_to_cstring(hb->actual_source_checksum, > + hb->pool)); > + } > } > > err = svn_error_compose_create(err, err2); >