Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9232275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:16:32+00:00 2026-06-18T06:16:32+00:00

I have a a single error when I run my program through valgrind. The

  • 0

I have a a single error when I run my program through valgrind. The problem is that it wont tell me where the uninitialised bytes were allocated:

==22141== Syscall param write(buf) points to uninitialised byte(s)
==22141==    at 0x5B68900: __write_nocancel (syscall-template.S:82)
==22141==    by 0x5AFB882: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1289)
==22141==    by 0x5AFB749: new_do_write (fileops.c:543)
==22141==    by 0x5AFCEB4: _IO_do_write@@GLIBC_2.2.5 (fileops.c:516)
==22141==    by 0x5AFDD3E: _IO_switch_to_get_mode (genops.c:189)
==22141==    by 0x5AFBA96: _IO_file_seekoff@@GLIBC_2.2.5 (fileops.c:999)
==22141==    by 0x5AF4F25: rewind (rewind.c:37)
==22141==    by 0x567D149: CBFileAppend (CBFileEC.c:69)
==22141==    by 0x5473AFA: CBDatabaseCreateDeletionIndex (CBDatabase.c:270)
==22141==    by 0x5473195: CBInitDatabase (CBDatabase.c:112)
==22141==    by 0x54721A1: CBNewAddressStorage (CBAddressStorage.c:37)
==22141==    by 0x401F67: main (testCBAddressManager.c:226)
==22141==  Address 0x402a009 is not stack'd, malloc'd or (recently) free'd
==22141==  Uninitialised value was created by a stack allocation
==22141==    at 0x546F750: ??? (in /media/sf_BitEagle_Projects/cbitcoin/bin/libcbitcoin-storage.2.0.so)

Would I be correct in assuming this means some sort of invalid pointer to the stack? This happens in rewind() and I do not understand why rewind would be like this. I tried attaching the valgrind process to gdb and I tried to print the result of the ftell() on the file pointer. This caused valgrind to exit with this:

valgrind: m_syswrap/syswrap-main.c:1296 (vgPlain_client_syscall): Assertion 'sci->status.what == SsIdle' failed.
==22938==    at 0x3804CA36: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==22938==    by 0x3804CBDC: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==22938==    by 0x38091F55: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==22938==    by 0x3808E5DF: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==22938==    by 0x3808F739: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==22938==    by 0x3809F7D5: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==22938==    at 0x5B68900: __write_nocancel (syscall-template.S:82)
==22938==    by 0x5AFB882: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1289)
==22938==    by 0x5AFB749: new_do_write (fileops.c:543)
==22938==    by 0x5AFCEB4: _IO_do_write@@GLIBC_2.2.5 (fileops.c:516)
==22938==    by 0x5AFDD3E: _IO_switch_to_get_mode (genops.c:189)
==22938==    by 0x5AFBA96: _IO_file_seekoff@@GLIBC_2.2.5 (fileops.c:999)
==22938==    by 0x5AF1AA5: ftell (ioftell.c:41)
==22938==    by 0x40133F: ??? (in /media/sf_BitEagle_Projects/cbitcoin/bin/testCBAddressManager)
==22938==    by 0xF75E467: ???
==22938==    by 0x7FEFFF3BF: ???
==22938==    by 0xF75E467: ???
==22938==    by 0x546DE87: ??? (in /media/sf_BitEagle_Projects/cbitcoin/bin/libcbitcoin-storage.2.0.so)
==22938==    by 0x7FEFFF3DF: ???

How would I go about determining the cause of this error?

Edit: I fixed the other issue I was having but this persists.

This is from the code here: https://github.com/MatthewLM/cbitcoin/blob/master/test/testCBAddressManager.c

The file IO code is here: https://github.com/MatthewLM/cbitcoin/tree/master/dependencies/storage

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:16:33+00:00Added an answer on June 18, 2026 at 6:16 am

    Syscall param write(buf) points to uninitialised byte(s)

    There isn’t necessarily anything wrong with that. Consider:

    int main() {
      struct Foo { int a; int b; int c; } x;
      x.a = 1; x.c = 3;
      write(1, &x, sizeof(x));  // part of x is not initialized
      return 0;
    }
    

    If later you read the data back in, and only use .a and .c members, then your program is well defined.

    Would I be correct in assuming this means some sort of invalid pointer to the stack?

    No.

    If you really wanted to find out which part of data is uninitialized, use Valgrind’d built-in gdbserver, and issue monitor check_memory defined command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a single page website that changes content based on variables passed through
I have some unit tests set up in my PowerBuilder application that run through
I have A single page that has the following structure <form runat=server><placeholder></placeholder></form> I have
I have a single-view application that takes in a username and a password and
I have a single-threaded application that uses 3 SQLite databases in 3 different files
I have a program written in foxpro (~shudder~) that I've inherited. The issue is,
I have a clojure program that at some point executes a function called db-rebuild-files-table
Okay, I have a strange problem. I wanted to run one of my programs
I have the following layout for my test suite: TestSuite1.cmd: Run my program Check
Hi there I have written a code that ietrates through whole array and copies

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.