git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 0/7] reftable: avoid reading and writing empty keys

From
Han-Wen Nienhuys via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 21, 2022, 18:46 UTC
Message-ID
<pull.1185.v3.git.git.1645469170.gitgitgadget@gmail.com>
In-Reply-To
<pull.1185.v2.git.git.1645106124.gitgitgadget@gmail.com>

this series makes sure that the object record does not have to consider empty keys (and therefore, a NULL memcpy destination)

while we're at it add some more tests, and fix a naming mistake.
Han-Wen Nienhuys (7):
  Documentation: object_id_len goes up to 31
  reftable: reject 0 object_id_len
  reftable: add a test that verifies that writing empty keys fails
  reftable: avoid writing empty keys at the block layer
  reftable: ensure that obj_id_len is >= 2 on writing
  reftable: add test for length of disambiguating prefix
  reftable: rename writer_stats to reftable_writer_stats
 Documentation/technical/reftable.txt |   2 +-
 reftable/block.c                     |  27 ++++---
 reftable/block_test.c                |   5 ++
 reftable/reader.c                    |   5 ++
 reftable/readwrite_test.c            | 105 ++++++++++++++++++++++++++-
 reftable/reftable-writer.h           |   2 +-
 reftable/writer.c                    |   9 ++-
 7 files changed, 136 insertions(+), 19 deletions(-)
base-commit: 45fe28c951c3e70666ee4ef8379772851a8e4d32
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1185%2Fhanwen%2Fobj-id-len-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1185/hanwen/obj-id-len-v3
Pull-Request: https://github.com/git/git/pull/1185
Range-diff vs v2:
 1:  80d29e8f269 = 1:  80d29e8f269 Documentation: object_id_len goes up to 31
 2:  4c1a19fc4ae ! 2:  68e7bc32ff8 reftable: reject 0 object_id_len
     @@ Commit message
          reftable: reject 0 object_id_len
      
          The spec says 2 <= object_id_len <= 31. We are lenient and allow 1,
     -    but we forbid 0, so we can we can be sure that we never read a
     -    0-length key.
     +    but we forbid 0, so we can be sure that we never read a 0-length key.
      
          Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
      
 3:  600b115f8b1 = 3:  8b5aebdb07a reftable: add a test that verifies that writing empty keys fails
 4:  ba036ee8543 ! 4:  a9372cacd1b reftable: avoid writing empty keys at the block layer
     @@ reftable/block.c: int block_reader_first_key(struct block_reader *br, struct str
       	if (n < 0)
       		return n;
      +	if (!key->len)
     -+		return -1;
     ++		return REFTABLE_FORMAT_ERROR;
       
       	return 0;
       }
 5:  2bd3d44ba57 = 5:  0b8a42399dd reftable: ensure that obj_id_len is >= 2 on writing
 6:  82d36ee0e0d = 6:  bdccd969475 reftable: add test for length of disambiguating prefix
 7:  c6ffdb3471c = 7:  72499a14e38 reftable: rename writer_stats to reftable_writer_stats
-- 
gitgitgadget
Previous: Junio C HamanoNext: Han-Wen Nienhuys via GitGitGadget
Message 25 of 33 in “reftable: avoid reading and writing empty keys”
  1. 0/7 reftable: avoid reading and writing empty keysHan-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  2. 1/7 Documentation: object_id_len goes up to 31Han-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  3. 2/7 reftable: reject 0 object_id_lenHan-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  4. 3/7 reftable: add a test that verifies that writing empty keys failsHan-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  5. 4/7 reftable: avoid writing empty keys at the block layerHan-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  6. Junio C HamanoJan 14, 2022
  7. Han-Wen NienhuysJan 17, 2022
  8. Junio C HamanoJan 17, 2022
  9. 5/7 reftable: ensure that obj_id_len is >= 2 on writingHan-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  10. 6/7 reftable: add test for length of disambiguating prefixHan-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  11. 7/7 reftable: rename writer_stats to reftable_writer_statsHan-Wen Nienhuys via GitGitGadget, Jan 12, 2022
  12. 0/7 reftable: avoid reading and writing empty keysHan-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  13. 1/7 Documentation: object_id_len goes up to 31Han-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  14. 2/7 reftable: reject 0 object_id_lenHan-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  15. Junio C HamanoFeb 18, 2022
  16. 3/7 reftable: add a test that verifies that writing empty keys failsHan-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  17. 4/7 reftable: avoid writing empty keys at the block layerHan-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  18. Junio C HamanoFeb 17, 2022
  19. Han-Wen NienhuysFeb 21, 2022
  20. 5/7 reftable: ensure that obj_id_len is >= 2 on writingHan-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  21. Junio C HamanoFeb 18, 2022
  22. 6/7 reftable: add test for length of disambiguating prefixHan-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  23. 7/7 reftable: rename writer_stats to reftable_writer_statsHan-Wen Nienhuys via GitGitGadget, Feb 17, 2022
  24. Junio C HamanoFeb 18, 2022
  25. 0/7 reftable: avoid reading and writing empty keysHan-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  26. 2/7 reftable: reject 0 object_id_lenHan-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  27. 1/7 Documentation: object_id_len goes up to 31Han-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  28. 4/7 reftable: avoid writing empty keys at the block layerHan-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  29. 3/7 reftable: add a test that verifies that writing empty keys failsHan-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  30. 5/7 reftable: ensure that obj_id_len is >= 2 on writingHan-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  31. 6/7 reftable: add test for length of disambiguating prefixHan-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  32. 7/7 reftable: rename writer_stats to reftable_writer_statsHan-Wen Nienhuys via GitGitGadget, Feb 21, 2022
  33. Junio C HamanoFeb 23, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.