Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
gc
0001-Fix-calloc-overflow.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fix-calloc-overflow.patch of Package gc
From e10c1eb9908c2774c16b3148b30d2f3823d66a9a Mon Sep 17 00:00:00 2001 From: Xi Wang <xi.wang@gmail.com> Date: Thu, 15 Mar 2012 04:46:49 +0800 Subject: [PATCH] Fix calloc() overflow * malloc.c (calloc): Check multiplication overflow in calloc(), assuming REDIRECT_MALLOC. --- malloc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/malloc.c b/malloc.c index da68f13..cc0cc00 100644 --- a/malloc.c +++ b/malloc.c @@ -372,8 +372,13 @@ void * malloc(size_t lb) } #endif /* GC_LINUX_THREADS */ +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif void * calloc(size_t n, size_t lb) { + if (lb && n > SIZE_MAX / lb) + return NULL; # if defined(GC_LINUX_THREADS) /* && !defined(USE_PROC_FOR_LIBRARIES) */ /* libpthread allocated some memory that is only pointed to by */ /* mmapped thread stacks. Make sure it's not collectable. */ -- 1.7.7
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor