Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 87770 Details for
Bug 130889
media-libs/jpeg: maxmem feature not used (DoS via memory exhaustion)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated patch supporting FreeBSD and DragonFly and with fallback.
60_all_jpeg-maxmem-sysconf.patch (text/plain), 1.28 KB, created by
Diego Elio Pettenò (RETIRED)
on 2006-05-28 17:50:07 UTC
(
hide
)
Description:
Updated patch supporting FreeBSD and DragonFly and with fallback.
Filename:
MIME Type:
Creator:
Diego Elio Pettenò (RETIRED)
Created:
2006-05-28 17:50:07 UTC
Size:
1.28 KB
patch
obsolete
># Make a reasonable guess about memory limits using sysconf(). ># includes 5% slop factor as suggested in documentation. > >Index: jpeg-6b/jmemansi.c >=================================================================== >--- jpeg-6b.orig/jmemansi.c >+++ jpeg-6b/jmemansi.c >@@ -12,6 +12,15 @@ > * is shoved onto the user. > */ > >+#include <unistd.h> >+ >+#ifdef __FreeBSD__ >+#include <sys/types.h> >+#include <sys/sysctl.h> >+#include <sys/vmmeter.h> >+#include <vm/vm_param.h> >+#endif >+ > #define JPEG_INTERNALS > #include "jinclude.h" > #include "jpeglib.h" >@@ -157,7 +166,24 @@ jpeg_open_backing_store (j_common_ptr ci > GLOBAL(long) > jpeg_mem_init (j_common_ptr cinfo) > { >- return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ >+#ifdef _SC_AVPHYS_PAGES >+ long phys_size; >+ >+ if ((phys_size = sysconf(_SC_AVPHYS_PAGES)) == -1) >+ return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ >+ if ((phys_size *= sysconf(_SC_PAGESIZE)) < 0) >+ return DEFAULT_MAX_MEM; >+ return (long) (phys_size * 0.95); >+#elif defined(__FreeBSD__)|| defined(__DragonFly__) >+ int mib[2] = { CTL_VM, VM_METER } >+ struct vmtotal memory; >+ size_t len = sizeof(memory); >+ >+ sysctl(mib, 2, &memory, &len, NULL, 0); >+ return (long) (memory->t_free * getpagesize() * 0.95); >+#endif >+ >+ return DEFAULT_MAX_MEM; > } > > GLOBAL(void)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 130889
:
85214
|
85252
|
85260
|
87770
|
88017
|
88028
|
88029