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 7603411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:38:58+00:00 2026-05-30T23:38:58+00:00

I get this heap corruption detected message after running this code : uli& uli::operator

  • 0

I get this “heap corruption detected” message after running this code :

uli& uli::operator =(char* n)
{
    char* buffer = new char[strlen(n)];

    char* p;
    int op;
    int coef;

    strcpy(buffer, n);

    while(*buffer)
    {
        op = strlen(buffer) - 5;
        p = (op >= 0) ? op+buffer : buffer;
        coef = atoi(p);

        if(coef > 65535)
            coef = atoi(++p);

        push(head, coef);
        *p = '\0';
    }

    delete buffer;       //  <- heap corruption detected

    return *this;
}

This is how I call the method:

uli x;
x = "9876123";

What does “heap corruption detected” mean ?

  • 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-05-30T23:39:00+00:00Added an answer on May 30, 2026 at 11:39 pm

    “Heap corruption” generally means you wrote into unallocated memory, damaging the data structures used to make the memory allocator work.

    There may be more problems, but the first one I see is on this line:

    strcpy(buffer, n);
    

    This will write strlen(n) + 1 bytes to buffer, but buffer is only strlen(n) bytes long (the extra byte is the terminating \0.) Writing that extra byte results in undefined behavior, and may well corrupt the heap.

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

Sidebar

Related Questions

I get this message: Cannot find the X.509 certificate using the following search criteria:
I get this error message when installing SQL 2005 Analysis services. The cabinet File
I get this message when trying to communicate with software that communicates with SOAP?
Sometimes in execution I get this error message in VS2010 when trying to free
I'm currently attempting to track down the source of heap corruption in our code
I get this exception: Exception in thread AWT-EventQueue-0 java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2882)
If I compiled this: long double *N; N = new long double[999999999]; I get
I get this error: Can't locate Foo.pm in @INC Is there an easier way
I get this error on an update panel within a popupControlExtender which is within
I get this error when I do an svn update : Working copy XXXXXXXX

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.