php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53583 [PATCH] add support for compiler "alloc_size" attribute
Submitted: 2010-12-20 19:19 UTC Modified: 2012-06-02 02:08 UTC
From: crrodriguez at opensuse dot org Assigned: nlopess (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3SVN-2010-12-20 (SVN) OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: crrodriguez at opensuse dot org
New email:
PHP Version: OS:

 

 [2010-12-20 19:19 UTC] crrodriguez at opensuse dot org
Description:
------------
The attached patch Introduces support for GCC alloc_size attribute, very useful 
to catch buffer overflows at compile time.





Test script:
---------------
PHP_FUNCTION(verybuggy) {
[...]

char *p;
p = emalloc(6);
strcpy(p,"cdcdccdscdscscsdcscddsc");
[...]
}

Expected result:
----------------
#make

buggy.c:N:N:
/usr/include/bits/string3.h:107:3: warning: call to __builtin___strcpy_chk will 
always overflow destination buffer


Actual result:
--------------
No warning at all, dangerous code goes unnoticed.


Patches

5_3 (last revision 2010-12-20 18:22 UTC by crrodriguez at opensuse dot org)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-21 15:43 UTC] johannes@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2011-12-27 09:19 UTC] stas@php.net
-Type: Security +Type: Feature/Change Request
 [2012-06-02 02:08 UTC] nlopess@php.net
I commited a similar patch already.
 [2012-06-02 02:08 UTC] nlopess@php.net
-Status: Assigned +Status: Closed -Assigned To: dmitry +Assigned To: nlopess
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 02:01:30 2024 UTC