rellermeyer / course_os

CS 439 course OS
BSD 3-Clause "New" or "Revised" License
38 stars 26 forks source link

os_printf does not work for a certain amount of characters. #31

Closed carpet-stain closed 4 years ago

carpet-stain commented 9 years ago

When attempting to print out between 52 and 60 characters, the program runs in an infinite loop.

lkolbly commented 9 years ago

Having trouble reproducing. Can you post a commit ID which shows the bug? (I'll probably start looking into this tomorrow)

carpet-stain commented 9 years ago

499a5acf445c83cac07db5c75ddca6a90947212d

lkolbly commented 9 years ago

This bug appears to be linked in some way to the os_memset bug, which has been fixed in master. I just pushed some changes to the branch, look at streams.c:91 and streams.c:22.

This doesn't appear to do what you think it does: struct foo *p; memset(&p, 0, sizeof(p)) p->field = 123;

Because that's equivalent to: struct foo *p = 0x0; p->field = 123; Which is clearly not what you want to do.

I think this is what is behind the bug in question.

jdonszelmann commented 4 years ago

seems to work now