Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C97910B96 for ; Thu, 7 May 2015 08:55:00 +0000 (UTC) Received: (qmail 10226 invoked by uid 500); 7 May 2015 08:55:00 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 10193 invoked by uid 500); 7 May 2015 08:55:00 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 10145 invoked by uid 99); 7 May 2015 08:55:00 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2015 08:55:00 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id E619CAC010F for ; Thu, 7 May 2015 08:54:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1678147 - /subversion/trunk/subversion/libsvn_subr/hash.c Date: Thu, 07 May 2015 08:54:59 -0000 To: commits@subversion.apache.org From: stsp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150507085459.E619CAC010F@hades.apache.org> Author: stsp Date: Thu May 7 08:54:59 2015 New Revision: 1678147 URL: http://svn.apache.org/r1678147 Log: Provide slightly more specific error messages when parsing hashes. * subversion/libsvn_subr/hash.c (svn_hash__read_entry): In error messages, hint at which part of the serialized hash failed to parse, rather than using the same error message in all failure cases. Fix typo in comment while here. Modified: subversion/trunk/subversion/libsvn_subr/hash.c Modified: subversion/trunk/subversion/libsvn_subr/hash.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/hash.c?rev=1678147&r1=1678146&r2=1678147&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/hash.c (original) +++ subversion/trunk/subversion/libsvn_subr/hash.c Thu May 7 08:54:59 2015 @@ -135,7 +135,7 @@ svn_hash__read_entry(svn_hash__entry_t * 0, APR_SIZE_MAX, 10); if (err) return svn_error_create(SVN_ERR_MALFORMED_FILE, err, - _("Serialized hash malformed")); + _("Serialized hash malformed key length")); entry->keylen = (apr_size_t)ui64; /* Now read that much into a buffer. */ @@ -148,19 +148,19 @@ svn_hash__read_entry(svn_hash__entry_t * SVN_ERR(svn_stream_read_full(stream, &c, &len)); if (c != '\n') return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, - _("Serialized hash malformed")); + _("Serialized hash malformed key data")); /* Read a val length line */ SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eof, pool)); if ((buf->data[0] == 'V') && (buf->data[1] == ' ')) { - /* Get the length of the key */ + /* Get the length of the val */ err = svn_cstring_strtoui64(&ui64, buf->data + 2, 0, APR_SIZE_MAX, 10); if (err) return svn_error_create(SVN_ERR_MALFORMED_FILE, err, - _("Serialized hash malformed")); + _("Serialized hash malformed value length")); entry->vallen = (apr_size_t)ui64; entry->val = apr_palloc(pool, entry->vallen + 1); @@ -172,7 +172,7 @@ svn_hash__read_entry(svn_hash__entry_t * SVN_ERR(svn_stream_read_full(stream, &c, &len)); if (c != '\n') return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, - _("Serialized hash malformed")); + _("Serialized hash malformed value data")); } else return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, @@ -186,7 +186,7 @@ svn_hash__read_entry(svn_hash__entry_t * 0, APR_SIZE_MAX, 10); if (err) return svn_error_create(SVN_ERR_MALFORMED_FILE, err, - _("Serialized hash malformed")); + _("Serialized hash malformed key length")); entry->keylen = (apr_size_t)ui64; /* Now read that much into a buffer. */ @@ -199,7 +199,7 @@ svn_hash__read_entry(svn_hash__entry_t * SVN_ERR(svn_stream_read_full(stream, &c, &len)); if (c != '\n') return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, - _("Serialized hash malformed")); + _("Serialized hash malformed key data")); /* Remove this hash entry. */ entry->vallen = 0;