Commit Graph
3 Commits
Author SHA1 Message Date
Claude 43768781c8 Fix valgrind uninitialized memory errors
Fixed multiple uninitialized memory issues detected by valgrind:

1. SHA256 struct size mismatch: Changed from 64 bytes to 32 bytes to
   match the actual output of sha256() function (which produces 256
   bits = 32 bytes).

2. File tree chunk allocation: Fixed loop that wasn't initializing
   newly allocated chunks because num_chunks was updated before the
   initialization loop. Now saves old_num_chunks first.

3. Metadata server process_client_write: Initialized results[i].num_addrs
   to 0 before use to prevent reading uninitialized value.

4. Address struct initialization: Zero-initialize Address structs before
   setting fields to ensure the entire union is initialized (union
   contains either IPv4 or IPv6, leaving unused bytes uninitialized).

5. Fixed bug in IPv6 address creation: Changed incorrect is_ipv4=true
   to is_ipv4=false for IPv6 addresses.

6. Fixed all_chunk_servers_holding_chunk: Function was incrementing
   counter for all chunk servers instead of only those containing the
   hash, causing access to uninitialized array elements.

All valgrind errors resolved: ERROR SUMMARY: 0 errors from 0 contexts
2025-11-08 16:26:12 +00:00
cozis e124952fe2 Progress 2025-11-05 14:26:57 +01:00
cozis c5a21608d7 Split project over multiple files 2025-10-28 17:24:25 +01:00