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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:32:22+00:00 2026-05-25T09:32:22+00:00

Though the actual implementation is platform specific, this idea is the cause for potentially

  • 0

Though the actual implementation is platform specific, this idea is the cause for potentially dangerous buffer overflows. For example,

-------------
|   arr[0]  | \
-------------  \
|   arr[1]  |   -> arr[3] is local to a function
-------------  /
|   arr[2]  | /
-------------
| frame ptr |
-------------
|  ret val  |
-------------
|  ret addr |
-------------
|    args   |
-------------

My question is, is there a reason why the local array, for lack of a better verb, flows down? Instead, if the array was to flow up, wouldn’t it significantly reduce the number of buffer overflow errors that overwrite the return address?

Granted, by using threads, one could overwrite the return address of a function that the current one has called. But lets ignore it for now.

  • 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-25T09:32:22+00:00Added an answer on May 25, 2026 at 9:32 am

    The array on the stack works just like an array on the heap, i.e. its index increases as the memory address increases.

    The stack grows downwards (towards lower addresses) instead of upwards, which is the reason for the array going in the opposite direction of the stack. There is some historic reason for that, probably from the time when the code, heap and stack resided in the same memory area, so the heap and the stack grew from each end of the memory.

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

Sidebar

Related Questions

Though it's on the edge of programming questions, I think this is still relevant
I have a question, less pertaining to actual implementation more towards how it works.
Tried to search but no specific answers (I am very new in this)... With
This is mostly a philosophy question, as the actual problem is solved. The SDK
Though it's debatable, I've heard the majority of CSS developers prefer multi-line because of
Even though I always strive for complete validation these days, I often wonder if
Even though I have a robust and fast computer (Pentium Dual Core 2.0 with
Even though I've been a developer for awhile I've been lucky enough to have
Even though MDI is considered harmful , several applications (even MS Office, Adobe apps)
Even though it's not part of HTTP 1.1/RFC2616 webapps that wish to force a

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.