Re: [PATCH v3] sparse index: fix use-after-free bug in cache_tree_verify()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bagas

On 08/10/2021 10:38, Bagas Sanjaya wrote:
On 08/10/21 01.07, Phillip Wood via GitGitGadget wrote:
-static void verify_one(struct repository *r,
-               struct index_state *istate,
-               struct cache_tree *it,
-               struct strbuf *path)
+/*
+ * Returns:
+ *  0 - Verification completed.
+ *  1 - Restart verification - a call to ensure_full_index() freed the cache + *      tree that is being verified and verification needs to be restarted from
+ *      the new toplevel cache tree.
+ */
+static int verify_one(struct repository *r,
+              struct index_state *istate,
+              struct cache_tree *it,
+              struct strbuf *path)
  {
      int i, pos, len = path->len;
      struct strbuf tree_buf = STRBUF_INIT;

What is verify_one() doing? I think it worth mentioning it in the comment above.

I think it's pretty obvious if you read the code rather than my patch. It is a common pattern in git that a function with "one" in the name is a helper for another similarly named function without the "one". In this case verify_one() is a recursive helper for cache_tree_verify()

Best Wishes

Phillip



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux