nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 19.03 28 lines 732 B view raw
1--- libwmf-0.2.8.4.orig/src/player.c 2+++ libwmf-0.2.8.4/src/player.c 3@@ -23,6 +23,7 @@ 4 5 #include <stdio.h> 6 #include <stdlib.h> 7+#include <stdint.h> 8 #include <string.h> 9 #include <math.h> 10 11@@ -132,8 +133,14 @@ 12 } 13 } 14 15-/* P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API)-3) * 2 * sizeof (unsigned char)); 16- */ P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API) ) * 2 * sizeof (unsigned char)); 17+ if (MAX_REC_SIZE(API) > UINT32_MAX / 2) 18+ { 19+ API->err = wmf_E_InsMem; 20+ WMF_DEBUG (API,"bailing..."); 21+ return (API->err); 22+ } 23+ 24+ P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API) ) * 2 * sizeof (unsigned char)); 25 26 if (ERR (API)) 27 { WMF_DEBUG (API,"bailing..."); 28