You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Evgeny Kotkov <ev...@visualsvn.com> on 2013/12/10 04:34:52 UTC

[PATCH] svn_fs_fs__get_changes: do not crash without cache

Hi,

I've noticed that the svn_fs_fs__get_changes function currently invokes
undefined behavior when there is no CHANGES_CACHE present.   According to the
fs_fs_data_t contract, this is a perfectly valid situation (see
subversion\libsvn_fs_fs\fs.h around trunk@1549686):
[[[
  /* Private (non-shared) FSFS-specific data for each svn_fs_t object.
     Any caches in here may be NULL. */
]]]

However, explicitly setting the CHANGES_CACHE to NULL leads to a massive amount
of failing tests (1085 fails on my 64-bit Ubuntu machine, some of them are
segfaults).  This erroneous behavior was introduced in r1512904 [1] and happens
due to the usage of the uninitialized variable FOUND when the CHANGES_CACHE
is absent.  The behavior in this case is undefined and that will likely lead to
a crash.  Here is a tip from valgrind:
[[[
  Conditional jump or move depends on uninitialised value(s)
    at 0x4852AF: svn_fs_fs__get_changes (cached_data.c:2183)
    by 0x469E4C: svn_fs_fs__paths_changed (transaction.c:889)
    by 0x475CDE: fs_paths_changed (tree.c:3291)
    by 0x44DCE7: svn_fs_paths_changed2 (fs-loader.c:1006)
    ...

  Use of uninitialised value of size 8
    at 0x469E8C: svn_fs_fs__paths_changed (transaction.c:892)
    by 0x475CDE: fs_paths_changed (tree.c:3291)
    by 0x44DCE7: svn_fs_paths_changed2 (fs-loader.c:1006)
    ...
]]]

This happens with both FSFS and FSX, so I've attached two patches to fix this
issue (these patches fix the svn_fs_fs__get_changes and svn_fs_x__get_changes
functions accordingly).

[1] http://svn.apache.org/viewvc?view=revision&revision=r1512904


Thanks and regards,
Evgeny Kotkov

Re: [PATCH] svn_fs_fs__get_changes: do not crash without cache

Posted by Branko Čibej <br...@wandisco.com>.
On 10.12.2013 04:34, Evgeny Kotkov wrote:
> Hi,
>
> I've noticed that the svn_fs_fs__get_changes function currently invokes
> undefined behavior when there is no CHANGES_CACHE present.

Committed in r1549766, thanks!

-- Brane


-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com