source: trunk/server/common/patches/dvipng-CVE-2010-0829.patch @ 1559

Last change on this file since 1559 was 1559, checked in by mitchb, 14 years ago
Patch for CVE-2010-0829... SSDP: Same Thing, Different Package
File size: 3.6 KB
  • dvipng.h

    old new  
    387374void      WriteImage(char*, int);
    388375void      LoadPK(int32_t, register struct char_entry *);
    389376int32_t   SetChar(int32_t);
    390 dviunits  SetGlyph(int32_t c, int32_t hh,int32_t vv);
     377dviunits  SetGlyph(struct char_entry *ptr, int32_t hh,int32_t vv);
    391378void      Gamma(double gamma);
    392 int32_t   SetVF(int32_t);
     379int32_t   SetVF(struct char_entry *ptr);
    393380int32_t   SetRule(int32_t, int32_t, int32_t, int32_t);
    394381void      SetSpecial(char *, int32_t, int32_t);
    395382void      BeginVFMacro(struct font_entry*);
  • draw.c

    old new  
    7979
    8080  if (currentfont==NULL)
    8181    Fatal("faulty DVI, trying to set character from null font");
    82 
    83   if (c>=0 && c<=LASTFNTCHAR)
    84     ptr = currentfont->chr[c];
     82  if (c<0 || c>LASTFNTCHAR) {
     83    Warning("glyph index out of range (%d), skipping",c);
     84    return(0);
     85  }
     86  ptr=currentfont->chr[c];
     87  if (ptr==NULL) {
     88    Warning("unable to draw glyph %d, skipping",c);
     89    return(0);
     90  }
    8591#ifdef DEBUG
    8692  switch (currentfont->type) {
    8793  case FONT_TYPE_VF: DEBUG_PRINT(DEBUG_DVI,("\n  VF CHAR:\t")); break;
     
    9096  case FONT_TYPE_FT: DEBUG_PRINT(DEBUG_DVI,("\n  FT CHAR:\t")); break;
    9197  default: DEBUG_PRINT(DEBUG_DVI,("\n  NO CHAR:\t"))
    9298  }
    93   if (isprint(c))
     99  if (debug & DEBUG_DVI && c>=0 && c<=UCHAR_MAX && isprint(c))
    94100    DEBUG_PRINT(DEBUG_DVI,("'%c' ",c));
    95101  DEBUG_PRINT(DEBUG_DVI,("%d at (%d,%d) tfmw %d", c,
    96102                         dvi_stack->hh,dvi_stack->vv,ptr?ptr->tfmw:0));
    97103#endif
    98104  if (currentfont->type==FONT_TYPE_VF) {
    99     return(SetVF(c));
     105    return(SetVF(ptr));
    100106  } else {
    101     if (ptr!=NULL && ptr->data == NULL)
     107    if (ptr->data == NULL)
    102108      switch(currentfont->type) {
    103109      case FONT_TYPE_PK:        LoadPK(c, ptr); break;
    104110#ifdef HAVE_LIBT1
     
    111117        Fatal("undefined fonttype %d",currentfont->type);
    112118      }
    113119    if (page_imagep != NULL)
    114       return(SetGlyph(c, dvi_stack->hh, dvi_stack->vv));
    115     else if (ptr!=NULL) {
     120      return(SetGlyph(ptr, dvi_stack->hh, dvi_stack->vv));
     121    else {
    116122      /* Expand bounding box if necessary */
    117123      min(x_min,dvi_stack->hh - ptr->xOffset/shrinkfactor);
    118124      min(y_min,dvi_stack->vv - ptr->yOffset/shrinkfactor);
  • vf.c

    old new  
    2727#define VF_ID 202
    2828#define LONG_CHAR 242
    2929
    30 int32_t SetVF(int32_t c)
     30int32_t SetVF(struct char_entry* ptr)
    3131{
    3232  struct font_entry* currentvf;
    3333  unsigned char *command,*end;
    34   struct char_entry* ptr=currentfont->chr[c];
    3534
    3635  currentvf=currentfont;
    3736  BeginVFMacro(currentvf);
  • set.c

    old new  
    203202  }
    204203}
    205204
    206 dviunits SetGlyph(int32_t c, int32_t hh,int32_t vv)
     205dviunits SetGlyph(struct char_entry *ptr, int32_t hh,int32_t vv)
    207206/* gdImageChar can only do monochrome glyphs */
    208207{
    209   register struct char_entry *ptr;
    210208  int dst_alpha,dst_weight,tot_weight,alpha;
    211209  int x,y,pos=0;
    212210  int bgColor,pixelgrey,pixelcolor;
    213211
    214   if (c<0 || c>LASTFNTCHAR) {
    215     Warning("glyph index too large (%d), skipping",c);
    216     return(0);
    217   }
    218   ptr=currentfont->chr[c];
    219   if (ptr==NULL) {
    220     Warning("unable to draw glyph %d, skipping",c);
    221     return(0);
    222   }
    223212  hh -= ptr->xOffset/shrinkfactor;
    224213  vv -= ptr->yOffset/shrinkfactor;
    225214  /* Initialize persistent color cache. Perhaps this should be in
Note: See TracBrowser for help on using the repository browser.