|

How To Fix DRIVER_OVERRAN_STACK_BUFFER Blue Screen

DRIVER_OVERRAN_STACK_BUFFER is a blue screen with the stop code 0xF7.

Microsoft says it means a driver has overrun a stack-based buffer.

Windows stops on purpose when it sees this, so the goal is to find and replace the driver or software that triggered it.

Table of Contents

Quick answer

Use this table to pick a starting point.

If this is trueTry this
The error started after a driver or hardware changeRoll back the driver or remove the new device
The PC reaches the desktopCheck Windows Update, then update drivers in Device Manager
The PC crashes during startupBoot into Safe Mode and disable the driver
Crashes continue after those stepsRun DISM and SFC, then restore or reset Windows
You want to find the exact driverOpen the crash dump in WinDbg and read the stack

What DRIVER_OVERRAN_STACK_BUFFER means

The bug check has the value 0x000000F7.

The stack is a small area of memory where a function keeps its local variables and its return address.

Microsoft says the driver wrote past the end of a buffer or local variable in a way that would have overwritten that return address.

That would make the function jump to an arbitrary address when it finished.

Why Windows stops the PC

Microsoft calls this the classic buffer overrun attack.

It says the system was brought down to prevent a malicious user from gaining complete control of it.

The check is a safety stop, and it does not by itself mean that someone attacked your PC.

A faulty driver can trip the same check without any attacker involved.

What the parameters mean

The crash dump records four values that explain how the check failed.

ParameterMeaning
1The actual security check cookie from the stack
2The expected security check cookie
3The bit-complement of the expected security check cookie
40

Parameters 1 and 2 let a debugger compare the cookie found on the stack with the cookie Windows expected.

Start with the basics

Microsoft’s general blue screen guide asks you to note the stop code and any module name shown on the screen.

If you added new hardware before the errors began, shut down, remove it and restart.

Open Event Viewer and look in the system log, which Microsoft says may name the device or driver behind a stop code.

Make sure the drive has some room, because Microsoft suggests keeping about 10% to 15% free.

Install Windows and driver updates

Microsoft recommends automatic updates through Windows Update before manual driver downloads.

  1. Open Start, then Settings, then Windows Update.
  2. Select Check for updates.
  3. Install everything offered and restart the PC.

Microsoft’s stop error guide also says to install the latest cumulative updates and to update the BIOS and firmware.

Update, roll back or remove the driver

Device Manager is the main tool for replacing a driver that overruns its buffer.

GoalSteps in Device Manager
UpdateRight-click the device, select Update driver, then search automatically
Manual updateUpdate driver, then Browse my computer for drivers, and pick the downloaded folder
Roll backRight-click the device, open Properties, then the Driver tab, then Roll Back Driver
ReinstallRight-click the device, select Uninstall device, confirm and restart

Download manual drivers only from the manufacturer’s official site, and match your Windows version.

Our guide to updating graphics drivers in Windows 11 shows the same process for a display adapter.

Use Safe Mode when the PC crashes at startup

If Windows cannot stay up long enough to change a driver, use Startup Settings.

  1. Open Settings, then System, then Recovery.
  2. Select Restart now next to Advanced startup.
  3. Choose Troubleshoot, then Advanced options, then Startup Settings, then Restart.
  4. Press 4 or F4 for Safe Mode, or 5 or F5 for Safe Mode with Networking.

Once in Safe Mode, update, roll back or disable the suspect driver in Device Manager.

Repair Windows files

Damaged system files can also disturb drivers, so run Microsoft’s two repair commands.

  1. Open Command Prompt as administrator.
  2. Run DISM.exe /Online /Cleanup-image /Restorehealth.
  3. Run sfc /scannow and wait for 100%.

Microsoft also suggests running Microsoft Safety Scanner or another antivirus scan, which is sensible given the attack wording above.

Find the driver in the crash dump

Microsoft’s resolution for this code is to get a stack trace with the kb command in the debugger.

The last routine on the stack before the buffer overrun handlers and the bug check call is the one that overran its local variable.

To try this, set Windows to write an automatic memory dump from Advanced system settings, then Settings under Startup and Recovery.

Open the dump on another PC in WinDbg and run !analyze -v.

Read the STACK_TEXT section for the .sys file closest to the failure.

Small dumps are saved in %SystemRoot%\Minidump, and larger ones in %SystemRoot%\MEMORY.DMP.

Test drivers with Driver Verifier

Microsoft describes Driver Verifier as a tool that isolates drivers in a special memory pool and validates their parameters.

It says to test suspicious drivers first, such as ones you updated recently.

If crashes stay unexplained, it says to verify all third-party and unsigned drivers, in groups of 10 to 20 at a time.

Microsoft warns that it uses a lot of CPU and can cause extra crashes and dump files.

Because it does not run in Safe Mode, you can use Safe Mode to switch it off if Windows will not reach the desktop.

Restore or reset Windows

If a recent change started the crashes, a restore point is Microsoft’s suggested route.

You can also uninstall a recent update, use Reset this PC and choose to keep your files, or reinstall from installation media.

Back up first, and keep your BitLocker recovery key handy.

When to contact support

If the stack points to a driver from a device maker, send that maker the dump and the stop code.

Microsoft says to contact the hardware vendor for diagnostics when hardware tests are needed.

What to collect before you ask for help

ItemWhere to find it
Stop code and module nameBottom of the blue screen
Dump file%SystemRoot%\Minidump or %SystemRoot%\MEMORY.DMP
Driver in the stackSTACK_TEXT after running !analyze -v
Related errorsSystem log in Event Viewer

Sources and related guides

Leave a Reply

Your email address will not be published. Required fields are marked *