title: What Can Cause a C Program to Crash Operating System
body: <p>I recently found that a fairly large image manipulation program I'm writing in C on a Windows 8 machine has a bug when used in very particular circumstances. Unfortunately, the bug is causing my entire computer to come to a standstill so that my only option is to pull the plug on the computer (especially annoying when I'm working remotely...)</p>
  
  <p>Because it's an image manipulation program, I can't just flood it with print statements to isolate the problematic section - the problem occurs somewhere in a loop that's called billions of times, so adding a printf slows it down to the point that it would take days to get to a failing iteration.</p>
  
  <p>I understand, therefore, if this question is too broad, as it isn't really reasonable for me to put down all of the code that could cause my problem, I'm simply asking</p>
  
  <p><strong>What are the circumstances in which C code can, instead of seg faulting or halting the program, actually freeze the entire OS</strong></p>
  
  <p>When I search the problem, I see code golf questions like this </p>
  
  <p><a href="https://stackoverflow.com/questions/7631423/a-c-program-which-crashes-the-systemshuts-down-the-system">A C program which crashes the system(shuts down the system)</a></p>
  
  <p>This is not what I'm asking - obviously I haven't written <em>system("shutdown")</em> anywhere in my loop.</p>
  
  <p>Being most familiar with python and java, this problem is not what I'm used to, but in my experience,</p>
  
  <ul>
  <li>Dividing by zero produces a seg fault</li>
  <li>Accessing memory by accident that is slightly outside an intended array causes a seg fault (sometimes down the road a little)</li>
  <li>Accessing protected memory causes the program to hang</li>
  <li>Stack overflow causes a seg fault</li>
  <li>Dereferencing a non-initialized pointer causes a seg fault</li>
  </ul>
  
  <p>Is this impression false - could those cases cause the whole system to crash? What cases am I missing? Is it dependent on my version of gcc, or my permission status?</p>
  
  <p>I haven't been able to try to reproduce it on a different operating system yet, as it requires a few dependencies to run the entire program.</p>
  
  <p>If my only option is to sit for days waiting for the program to run with print statements, or avoid weird situations, then, of course, so be it. I'm looking for key places to look for the bug.</p>