Microsoft Visual C++ Debug Library: Debug Assertion Failed! again

Sep 21, 2008 at 12:21 PM
Hello,

I'm using W2003 R2 SP2 server, IIS6 + ISAPI 1.2.14 with the basic Drupal .ini file included in the release.
According to the log file the following line causes the "Buffer too small" error:

DoRewrites: New Url: '/hangos_versek/1027%2B1028%2B1031%2B1033%2B1593%2B1594%2B1597%2B1598%2B1599%2B2728%2B2745%2B3369%2B3389%2B3454%2B2861%2B2909%2B2865%2B2913%2B4439%2B4727%2B4844%2B4908%2B4960%2B5351%2B5564%2B6197%2B6210%2B6530%2B6568%2B6596%2B6648%2B6663%2B7818%2B8062%2B2910%2B2849%2B2923%2B2922%2B2917%2B8337%2B8342%2B8351%2B8355%2B1657%2B9097%2B9753%2B10045%2B10260%2B10261%2B10549%2B10768%2B10944%2B10988%2B10990%2B11095%2B11196%2B11403%2B11404%2B11421%2B11424%2B11468%2B12075?sort=desc&order=Hozz%C3%A1-+sz%C3%B3l%C3%A1s%3A&filter0%5B0%5D=63'

Decoded it is:
DoRewrites: New Url: '/hangos_versek/1027+1028+1031+1033+1593+1594+1597+1598+1599+2728+2745+3369+3389+3454+2861+2909+2865+2913+4439+4727+4844+4908+4960+5351+5564+6197+6210+6530+6568+6596+6648+6663+7818+8062+2910+2849+2923+2922+2917+8337+8342+8351+8355+1657+9097+9753+10045+10260+10261+10549+10768+10944+10988+10990+11095+11196+11403+11404+11421+11424+11468+12075?sort=desc&order=Hozzá-+szólás:&filter0[0]=63'

When the error occurs and I hit "Abort", the whole site freezes.

What's the problem with the line? How could I modify the ini file to avoid the error?
(It doesn't crash Apache on my eval site.)

Thank you.
Coordinator
Oct 1, 2008 at 9:33 PM
Edited Oct 1, 2008 at 9:46 PM

hello, can I see your logfile?
There was a problem with the interpretation of the % character in URLs, which lead to bad pointers in the code.

That may be what you are seeing.

If you are using the latest (R3) version of IIRF 1.2.14, then I can suggest you add this line to your ini file, before any RewriteRule statements: 

CondSubstringBackrefFlag * 

And then run the URL again through the filter.
What this does is remove the ambiguity of the %  character in a RewriteRule. 
The % char is is the flag character for back-references in the most-recently matched RewriteCond statement.
But it is also the character for url-encoding.
So this new directive allows you to specify a different character.  I suggest *.

Oct 2, 2008 at 6:18 AM
Hello!

Thank you! I'll try what you suggested.

Here's the log:
02 08:10:38 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:38 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:38 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:38 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:38 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:41 2008 - DllMain THREAD_DETACH, threadId= 4224
Thu Oct 02 08:10:41 2008 - DllMain THREAD_DETACH, threadId= 700
Thu Oct 02 08:10:41 2008 - DllMain THREAD_DETACH, threadId= 5632
Thu Oct 02 08:10:41 2008 - DllMain THREAD_DETACH, threadId= 4076
Thu Oct 02 08:10:47 2008 - WARNING: Invalid Param Handler
Thu Oct 02 08:10:47 2008 - ApplyRules: Result (length 524): (too large to log)
Thu Oct 02 08:10:47 2008 - ApplyRules: Last if Match
Thu Oct 02 08:10:47 2008 - ApplyRules: returning 1
Thu Oct 02 08:10:47 2008 - DoRewrites: Rewrite Url to: '/index.php\?q=hangos_versek/1027%2B1028%2B1031%2B1033%2B1593%2B1594%2B1597%2B1598%2B1599%2B2728%2B2745%2B3369%2B3389%2B3454%2B2861%2B2909%2B2865%2B2913%2B4439%2B4727%2B4844%2B4908%2B4960%2B5351%2B5564%2B6197%2B6210%2B6530%2B6568%2B6596%2B6648%2B6663%2B7818%2B8062%2B2910%2B2849%2B2923%2B2922%2B2917%2B8337%2B8342%2B8351%2B8355%2B1657%2B9097%2B9753%2B10045%2B10260%2B10261%2B10549%2B10768%2B10944%2B10988%2B10990%2B11095%2B11196%2B11403%2B11404%2B11421%2B11424%2B11468%2B12075%2B12639%2B12955%2B13057%2B13090&filter0%5B%5D=63'
Thu Oct 02 08:10:47 2008 - DoRewrites: not recording OriginalUrl (0x000dcb60)
Thu Oct 02 08:10:47 2008 - DoRewrites: Finished
Thu Oct 02 08:10:47 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:47 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:47 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:47 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:47 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - WARNING: Invalid Param Handler
Thu Oct 02 08:10:48 2008 - ApplyRules: Result (length 524): (too large to log)
Thu Oct 02 08:10:48 2008 - ApplyRules: Last if Match
Thu Oct 02 08:10:48 2008 - ApplyRules: returning 1
Thu Oct 02 08:10:48 2008 - DoRewrites: Rewrite Url to: '/index.php\?q=hangos_versek/1027%2B1028%2B1031%2B1033%2B1593%2B1594%2B1597%2B1598%2B1599%2B2728%2B2745%2B3369%2B3389%2B3454%2B2861%2B2909%2B2865%2B2913%2B4439%2B4727%2B4844%2B4908%2B4960%2B5351%2B5564%2B6197%2B6210%2B6530%2B6568%2B6596%2B6648%2B6663%2B7818%2B8062%2B2910%2B2849%2B2923%2B2922%2B2917%2B8337%2B8342%2B8351%2B8355%2B1657%2B9097%2B9753%2B10045%2B10260%2B10261%2B10549%2B10768%2B10944%2B10988%2B10990%2B11095%2B11196%2B11403%2B11404%2B11421%2B11424%2B11468%2B12075%2B12639%2B12955%2B13057%2B13090&filter0%5B%5D=63'
Thu Oct 02 08:10:48 2008 - DoRewrites: not recording OriginalUrl (0x000d1440)
Thu Oct 02 08:10:48 2008 - DoRewrites: Finished
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - WARNING: Invalid Param Handler
Thu Oct 02 08:10:48 2008 - ApplyRules: Result (length 524): (too large to log)
Thu Oct 02 08:10:48 2008 - ApplyRules: Last if Match
Thu Oct 02 08:10:48 2008 - ApplyRules: returning 1
Thu Oct 02 08:10:48 2008 - DoRewrites: Rewrite Url to: '/index.php\?q=hangos_versek/1027%2B1028%2B1031%2B1033%2B1593%2B1594%2B1597%2B1598%2B1599%2B2728%2B2745%2B3369%2B3389%2B3454%2B2861%2B2909%2B2865%2B2913%2B4439%2B4727%2B4844%2B4908%2B4960%2B5351%2B5564%2B6197%2B6210%2B6530%2B6568%2B6596%2B6648%2B6663%2B7818%2B8062%2B2910%2B2849%2B2923%2B2922%2B2917%2B8337%2B8342%2B8351%2B8355%2B1657%2B9097%2B9753%2B10045%2B10260%2B10261%2B10549%2B10768%2B10944%2B10988%2B10990%2B11095%2B11196%2B11403%2B11404%2B11421%2B11424%2B11468%2B12075%2B12639%2B12955%2B13057%2B13090&filter0%5B%5D=63'
Thu Oct 02 08:10:48 2008 - DoRewrites: not recording OriginalUrl (0x000d2c10)
Thu Oct 02 08:10:48 2008 - DoRewrites: Finished
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:48 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - WARNING: Invalid Param Handler
Thu Oct 02 08:10:49 2008 - ApplyRules: Result (length 524): (too large to log)
Thu Oct 02 08:10:49 2008 - ApplyRules: Last if Match
Thu Oct 02 08:10:49 2008 - ApplyRules: returning 1
Thu Oct 02 08:10:49 2008 - DoRewrites: Rewrite Url to: '/index.php\?q=hangos_versek/1027%2B1028%2B1031%2B1033%2B1593%2B1594%2B1597%2B1598%2B1599%2B2728%2B2745%2B3369%2B3389%2B3454%2B2861%2B2909%2B2865%2B2913%2B4439%2B4727%2B4844%2B4908%2B4960%2B5351%2B5564%2B6197%2B6210%2B6530%2B6568%2B6596%2B6648%2B6663%2B7818%2B8062%2B2910%2B2849%2B2923%2B2922%2B2917%2B8337%2B8342%2B8351%2B8355%2B1657%2B9097%2B9753%2B10045%2B10260%2B10261%2B10549%2B10768%2B10944%2B10988%2B10990%2B11095%2B11196%2B11403%2B11404%2B11421%2B11424%2B11468%2B12075%2B12639%2B12955%2B13057%2B13090&filter0%5B%5D=63'
Thu Oct 02 08:10:49 2008 - DoRewrites: not recording OriginalUrl (0x00118720)
Thu Oct 02 08:10:49 2008 - DoRewrites: Finished
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - WARNING: Invalid Param Handler
Thu Oct 02 08:10:49 2008 - ApplyRules: Result (length 524): (too large to log)
Thu Oct 02 08:10:49 2008 - ApplyRules: Last if Match
Thu Oct 02 08:10:49 2008 - ApplyRules: returning 1
Thu Oct 02 08:10:49 2008 - DoRewrites: Rewrite Url to: '/index.php\?q=hangos_versek/1027%2B1028%2B1031%2B1033%2B1593%2B1594%2B1597%2B1598%2B1599%2B2728%2B2745%2B3369%2B3389%2B3454%2B2861%2B2909%2B2865%2B2913%2B4439%2B4727%2B4844%2B4908%2B4960%2B5351%2B5564%2B6197%2B6210%2B6530%2B6568%2B6596%2B6648%2B6663%2B7818%2B8062%2B2910%2B2849%2B2923%2B2922%2B2917%2B8337%2B8342%2B8351%2B8355%2B1657%2B9097%2B9753%2B10045%2B10260%2B10261%2B10549%2B10768%2B10944%2B10988%2B10990%2B11095%2B11196%2B11403%2B11404%2B11421%2B11424%2B11468%2B12075%2B12639%2B12955%2B13057%2B13090&filter0%5B%5D=63'
Thu Oct 02 08:10:49 2008 - DoRewrites: not recording OriginalUrl (0x00131ae8)
Thu Oct 02 08:10:49 2008 - DoRewrites: Finished
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:49 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:51 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Oct 02 08:10:51 2008 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Thu Oct 02 08:10:51 2008 - DoRewrites
Coordinator
Oct 2, 2008 at 10:23 PM
Edited Oct 2, 2008 at 10:41 PM
Yes, something bad is still happening.

I have reproduced the problem on my machine.
This is a bug in IIRF.

Let me look a little further.
Coordinator
Oct 3, 2008 at 1:11 AM
Edited Oct 3, 2008 at 6:39 AM
Ok, Heggy, can you do this for me?
Download v1.2.14 again, get the updated (R4) binary.
Run that updated binary with the same INI file, and tell me if you still see the problem.

I think the problem is this:  v1.2.14 is linked with a debug CRT library.  When a secure sprintf_s() call reports that it has not enough space, you get that dialog box.  The "Buffer too small" is not in itself an error - there is no buffer overrun.  That is simply a diagnostic message emitted by the debug CRT.  But it seems to have a poor effect on the behavior of the filter following the popup.  

So what I have done is set a call in the v1.2.14 DLL so that the dialog box does not pop up. 

Let me know if this helps you.

Oct 3, 2008 at 6:22 AM

Thanks a lot!

You solved the problem, no pop up windows.

Best Regards

Gabor

Coordinator
Oct 3, 2008 at 6:40 AM
Super! Glad it worked for you!