[tor-bugs] #31567 [Applications/Tor Browser]: NS_tsnprintf() does not handle %s correctly on Windows

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Aug 31 04:20:02 UTC 2019


#31567: NS_tsnprintf() does not handle %s correctly on Windows
-------------------------------------------------+-------------------------
 Reporter:  mcs                                  |          Owner:  gk
     Type:  defect                               |         Status:
                                                 |  needs_revision
 Priority:  Very High                            |      Milestone:
Component:  Applications/Tor Browser             |        Version:
 Severity:  Critical                             |     Resolution:
 Keywords:  ff68-esr, tbb-9.0-must-alpha,        |  Actual Points:
  TorBrowserTeam201908                           |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by pospeselr):

 Ok, so the reason why the above patch does not work with the clang build
 is that {{{StringCchVPrintfExW}}} which was meant to replace
 {{{_vsnwprintf}}} ultimately calls {{{_vsnwprintf}}} itself. This call
 ulimately goes down to {{{ucrtbase!__stdio_common_vswprintf}}} with the
 {{{UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION}}} (0x1) flag.
 Switching this flag to {{{UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS}}} (0x4)
 results in the behaviour that we want.

 Patching the binary at runtime in windbg and letting it run results in
 these files:

 update.log:

 {{{
 PATCH DIRECTORY
 C:\Users\user\Desktop\GKTest\Browser\TorBrowser\UpdateInfo\updates\0
 INSTALLATION DIRECTORY C:\Users\user\Desktop\GKTest
 WORKING DIRECTORY C:\Users\user\Desktop\GKTest
 failed: 6
 calling QuitProgressUI
 }}}

 update.status:
 {{{
 failed: 6
 }}}

 Not sure what the correct behaviour is here with regards to the updater
 but at least we get this far.

 I suspect this is a bug in mingw, but it's unclear to me at the moment
 what the right behaviour is here

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/31567#comment:14>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list