Thread: Curropted text

  1. #16
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    615
    Quote Originally Posted by Hodor View Post
    Well, I got it to compile by checking out to a previous git revision. I can't say I really understand what's going on though, I find it pretty complicated. I do know where the problem is though. But... hmm, yeah. Complicated (But, yes, it's reading and writing out of bounds)
    Either I didn't post that I eventually fixed the bug which turned out to be an unupdated variable used to fill the calculate the length (which caused only pieces of text to appear hence corruption) or you missed it, judging by how I can't find it despite remembering posting it I must've forgotten to post it. I did think it wierd how you seemed to be talking about a fixed bug, just didn't realise for sure until this post. Anyways thanks for the help, the current compile time bugs you mentioned are related to a new function I'm making that is going to process FPNs, I just haven't finished it yet cause I haven't quite identified what variables I need where and precisely how to handle them so I decided to make a small project on my computer to test on fixed FPNs with comparisons to FPNs cc creates, I have to do the math manually cause I plan to support base62 in FPNs also, it will surely pull interest from security companies at least who want to obfuscate their data and gcc developers will probably refuse to use it cause "it's not GPL!", *rolls eyes*.

  2. #17
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,457
    Quote Originally Posted by awsdert View Post
    Either I didn't post that I eventually fixed the bug which turned out to be an unupdated variable used to fill the calculate the length (which caused only pieces of text to appear hence corruption) or you missed it, judging by how I can't find it despite remembering posting it I must've forgotten to post it. I did think it wierd how you seemed to be talking about a fixed bug, just didn't realise for sure until this post. Anyways thanks for the help, the current compile time bugs you mentioned are related to a new function I'm making that is going to process FPNs, I just haven't finished it yet cause I haven't quite identified what variables I need where and precisely how to handle them so I decided to make a small project on my computer to test on fixed FPNs with comparisons to FPNs cc creates, I have to do the math manually cause I plan to support base62 in FPNs also, it will surely pull interest from security companies at least who want to obfuscate their data and gcc developers will probably refuse to use it cause "it's not GPL!", *rolls eyes*.

    Maybe it appears fixed, but it's not. The text isn't corrupted but there's still a bug

    Code:
        /* Should work yet somehow does not stop at '\0' like should */
        ((mcc_ch8_t*)(dstm->addr))[dstv->use * sizeof(mcc_ch8_t)] = 0;             /* illegal write originating from here */
    Code:
        while ( (ret = mcc_gets(&src)) == EXIT_SUCCESS )
            (void)printf( " '%s'", (char*)(src.text.vec.mem.addr) );                          /* illegal read originating from here */
    Code:
    ==29550== Invalid write of size 1
    ==29550==    at 0x4046C8: mcc_getall (mcc_get.c:465)
    ==29550==    by 0x404A79: mcc___gettext (mcc_get.c:529)
    ==29550==    by 0x404B34: mcc__gettext (mcc_get.c:537)
    ==29550==    by 0x404C39: mcc_ch8gettext (mcc_get.c:547)
    ==29550==    by 0x406B18: mcc_gets (mcc_get.c:960)
    ==29550==    by 0x407F76: _test (word.c:62)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550==  Address 0x4a56115 is 0 bytes after a block of size 21 alloc'd
    ==29550==    at 0x483880B: malloc (vg_replace_malloc.c:309)
    ==29550==    by 0x40729C: mcc_memsize (mcc_mem.c:57)
    ==29550==    by 0x407689: mcc_vecsize (mcc_mem.c:125)
    ==29550==    by 0x4044E8: mcc_getall (mcc_get.c:446)
    ==29550==    by 0x404A79: mcc___gettext (mcc_get.c:529)
    ==29550==    by 0x404B34: mcc__gettext (mcc_get.c:537)
    ==29550==    by 0x404C39: mcc_ch8gettext (mcc_get.c:547)
    ==29550==    by 0x406B18: mcc_gets (mcc_get.c:960)
    ==29550==    by 0x407F76: _test (word.c:62)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550== 
    ==29550== Invalid read of size 1
    ==29550==    at 0x483BBF4: strlen (vg_replace_strmem.c:461)
    ==29550==    by 0x48D3A1D: __vfprintf_internal (in /usr/lib64/libc-2.29.so)
    ==29550==    by 0x48BE38E: printf (in /usr/lib64/libc-2.29.so)
    ==29550==    by 0x407F6A: _test (word.c:63)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550==  Address 0x4a56115 is 0 bytes after a block of size 21 alloc'd
    ==29550==    at 0x483880B: malloc (vg_replace_malloc.c:309)
    ==29550==    by 0x40729C: mcc_memsize (mcc_mem.c:57)
    ==29550==    by 0x407689: mcc_vecsize (mcc_mem.c:125)
    ==29550==    by 0x4044E8: mcc_getall (mcc_get.c:446)
    ==29550==    by 0x404A79: mcc___gettext (mcc_get.c:529)
    ==29550==    by 0x404B34: mcc__gettext (mcc_get.c:537)
    ==29550==    by 0x404C39: mcc_ch8gettext (mcc_get.c:547)
    ==29550==    by 0x406B18: mcc_gets (mcc_get.c:960)
    ==29550==    by 0x407F76: _test (word.c:62)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550==

  3. #18
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    615
    Quote Originally Posted by Hodor View Post
    Maybe it appears fixed, but it's not. The text isn't corrupted but there's still a bug

    Code:
        /* Should work yet somehow does not stop at '\0' like should */
        ((mcc_ch8_t*)(dstm->addr))[dstv->use * sizeof(mcc_ch8_t)] = 0;             /* illegal write originating from here */
    Code:
        while ( (ret = mcc_gets(&src)) == EXIT_SUCCESS )
            (void)printf( " '%s'", (char*)(src.text.vec.mem.addr) );                          /* illegal read originating from here */
    Code:
    ==29550== Invalid write of size 1
    ==29550==    at 0x4046C8: mcc_getall (mcc_get.c:465)
    ==29550==    by 0x404A79: mcc___gettext (mcc_get.c:529)
    ==29550==    by 0x404B34: mcc__gettext (mcc_get.c:537)
    ==29550==    by 0x404C39: mcc_ch8gettext (mcc_get.c:547)
    ==29550==    by 0x406B18: mcc_gets (mcc_get.c:960)
    ==29550==    by 0x407F76: _test (word.c:62)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550==  Address 0x4a56115 is 0 bytes after a block of size 21 alloc'd
    ==29550==    at 0x483880B: malloc (vg_replace_malloc.c:309)
    ==29550==    by 0x40729C: mcc_memsize (mcc_mem.c:57)
    ==29550==    by 0x407689: mcc_vecsize (mcc_mem.c:125)
    ==29550==    by 0x4044E8: mcc_getall (mcc_get.c:446)
    ==29550==    by 0x404A79: mcc___gettext (mcc_get.c:529)
    ==29550==    by 0x404B34: mcc__gettext (mcc_get.c:537)
    ==29550==    by 0x404C39: mcc_ch8gettext (mcc_get.c:547)
    ==29550==    by 0x406B18: mcc_gets (mcc_get.c:960)
    ==29550==    by 0x407F76: _test (word.c:62)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550== 
    ==29550== Invalid read of size 1
    ==29550==    at 0x483BBF4: strlen (vg_replace_strmem.c:461)
    ==29550==    by 0x48D3A1D: __vfprintf_internal (in /usr/lib64/libc-2.29.so)
    ==29550==    by 0x48BE38E: printf (in /usr/lib64/libc-2.29.so)
    ==29550==    by 0x407F6A: _test (word.c:63)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550==  Address 0x4a56115 is 0 bytes after a block of size 21 alloc'd
    ==29550==    at 0x483880B: malloc (vg_replace_malloc.c:309)
    ==29550==    by 0x40729C: mcc_memsize (mcc_mem.c:57)
    ==29550==    by 0x407689: mcc_vecsize (mcc_mem.c:125)
    ==29550==    by 0x4044E8: mcc_getall (mcc_get.c:446)
    ==29550==    by 0x404A79: mcc___gettext (mcc_get.c:529)
    ==29550==    by 0x404B34: mcc__gettext (mcc_get.c:537)
    ==29550==    by 0x404C39: mcc_ch8gettext (mcc_get.c:547)
    ==29550==    by 0x406B18: mcc_gets (mcc_get.c:960)
    ==29550==    by 0x407F76: _test (word.c:62)
    ==29550==    by 0x40811E: main (word.c:100)
    ==29550==
    Thanks I'll take a look at those in a minute, got another thread to post

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 02-16-2019, 07:47 PM
  2. User enter text and save to text file (end enter text using -1)
    By DecoratorFawn82 in forum C Programming
    Replies: 7
    Last Post: 12-28-2017, 04:23 PM
  3. Type text = Press button = Display text in Google?
    By Raze88 in forum C++ Programming
    Replies: 4
    Last Post: 03-20-2008, 08:39 AM
  4. Replies: 4
    Last Post: 01-03-2006, 03:02 AM
  5. create a text file with data using text editor
    By fried egg in forum C Programming
    Replies: 3
    Last Post: 03-14-2002, 09:11 PM

Tags for this Thread