Test crashes on Windows #1334
              
  
  Closed
              
          
                  
                    
                      spanglerco
                    
                  
                
                  started this conversation in
                General
              
            Replies: 1 comment
-
| see 8a1dc8a | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
When building the module locally on Windows, the program built from test.c crashes with a segfault. This is because the test is doing
sizeof(void), which isn't valid in standard C and is implementation defined. GCC (by default) will convert that to 1, while MSVC will convert that to 0 and issue a warning C4034.In the GCC case, it's only working because
apr_pcallocwill align the allocation to 8 bytes, so it converts the 1 to an 8, which is large enough to fit a pointer. In the Windows case,apr_pcallocwith size 0 ends up returning a pointer to the next available free memory without actually reserving any memory, sorequest->server->module_config,request->per_dir_config, and whatever the next allocation is end up with the same pointer.I see it was changed from
sizeof(void *)tosizeof(void)in this commit, but I believesizeof(void *)was correct, asap_conf_vector_t *is really just avoid **.Beta Was this translation helpful? Give feedback.
All reactions