71 / scoop-better-shimexe

A better shim.exe file for Scoop.
MIT License
73 stars 29 forks source link

Fix out of bounds errors #12

Closed hasufell closed 3 years ago

hasufell commented 3 years ago

It seems the idea here was to have NUL terminated strings?

At any rate, this is an out of bounds error and calloc will take care of zeroing the memory anyway. We increment it by 1 element to make sure the string always ends with NUL.

Error log:

Dr. Memory version 2.3.0 build 1 built on Feb  6 2020 06:09:03
Windows version: WinVer=105;Rel=2009;Build=19042;Edition=Enterprise
Dr. Memory results for pid 5456: "shim.exe"
Application cmdline: "C:\Users\hasuf\scoop-better-shimexe\shim.exe"
Recorded 118 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin\suppress-default.txt

Error #1: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x02d085fc-0x02d085fe 2 byte(s)
# 0 main               [C:\Users\hasuf\scoop-better-shimexe\shim.c:117]
Note: @0:00:00.766 in thread 8832
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x02d085c0-0x02d085fc
Note: instruction: data16 mov    %ax -> (%edx,%ecx,2)

Error #2: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x02d08e62-0x02d08e64 2 byte(s)
# 0 main               [C:\Users\hasuf\scoop-better-shimexe\shim.c:129]
Note: @0:00:00.783 in thread 8832
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x02d08e40-0x02d08e62
Note: instruction: data16 mov    %dx -> (%ecx,%eax,2)

===========================================================================
FINAL SUMMARY:

DUPLICATE ERROR COUNTS:

SUPPRESSIONS USED:

ERRORS FOUND:
      2 unique,     2 total unaddressable access(es)
      0 unique,     0 total uninitialized access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      0 unique,     0 total handle leak(s)
      0 unique,     0 total warning(s)
      0 unique,     0 total,      0 byte(s) of leak(s)
      0 unique,     0 total,      0 byte(s) of possible leak(s)
ERRORS IGNORED:
      5 potential error(s) (suspected false positives)
         (details: C:\Users\hasuf\AppData\Roaming\Dr. Memory\DrMemory-shim.exe.5456.000\potential_errors.txt)
      1 potential leak(s) (suspected false positives)
         (details: C:\Users\hasuf\AppData\Roaming\Dr. Memory\DrMemory-shim.exe.5456.000\potential_errors.txt)
     31 unique,    80 total,  13957 byte(s) of still-reachable allocation(s)
         (re-run with "-show_reachable" for details)
Details: C:\Users\hasuf\AppData\Roaming\Dr. Memory\DrMemory-shim.exe.5456.000\results.txt