From: Stephan Brauss <sbrauss@optronic.ch>
To: linux-msdos@vger.kernel.org
Subject: A rather special bug?
Date: Tue, 25 Mar 2003 07:56:16 +0100 [thread overview]
Message-ID: <3E7FFD90.9F7DBF69@optronic.ch> (raw)
Hello!
I think that I have found a bug that is present at least in dosemu-1.0.2.
Compile the appended program, run it and press any key while
the memory testing loop is running. You will see that one byte of the
allocated memory blocks is altered and now contains the ascii code of
the pressed character. Can someone reproduce this problem? Is it fixed
in newer dosemu versions?
Stephan
----------------------
#include <stdio.h>
#include <stdlib.h>
#define SEGMENTS 7
#define SIZE 65500
int *segments[SEGMENTS];
int main()
{
int i,j,k;
for(i=0;i<SEGMENTS;i++)
{
printf("malloc segment %d\n",i+1);
segments[i]=(int *)malloc(SIZE);
if(segments[i]==NULL)
{
printf("malloc error\n");
exit(1);
}
for(j=0;j<SIZE/sizeof(int);j++)
segments[i][j]=0;
}
k=1;
for(;;)
{
printf("loop: %d\n",k);
for(i=0;i<SEGMENTS;i++)
{
for(j=0;j<SIZE/sizeof(int);j++)
{
if(segments[i][j]!=0)
{
printf("segments[%d][%d]=%d\n",i,j,segments[i][j]);
}
}
}
k++;
}
return 0;
}
reply other threads:[~2003-03-25 6:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E7FFD90.9F7DBF69@optronic.ch \
--to=sbrauss@optronic.ch \
--cc=linux-msdos@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox