~siretart/xine-lib/ubuntu

« back to all changes in this revision

Viewing changes to src/post/goom/goomsl_hash.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-12-15 13:13:45 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051215131345-8n4osv1j7fy9c1s1
* SECURITY UPDATE: Fix arbitrary code execution with crafted PNG images in
  embedded ffmpeg copy.
* src/libffmpeg/libavcodec/utils.c, avcodec_default_get_buffer(): Apply
  upstream patch to fix buffer overflow on decoding of small PIX_FMT_PAL8
  PNG files.
* References:
  CVE-2005-4048
  http://mplayerhq.hu/pipermail/ffmpeg-devel/2005-November/005333.html
  http://www1.mplayerhq.hu/cgi-bin/cvsweb.cgi/ffmpeg/libavcodec/
  utils.c.diff?r1=1.161&r2=1.162&cvsroot=FFMpeg

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
static GoomHashEntry *entry_new(const char *key, HashValue value) {
6
6
 
 
7
  int len = strlen(key);
7
8
        GoomHashEntry *entry = (GoomHashEntry*)malloc(sizeof(GoomHashEntry));
8
9
 
9
 
        entry->key = (char *)malloc(strlen(key)+1);
10
 
        strcpy(entry->key,key);
 
10
        entry->key = (char *)malloc(len+1);
 
11
        memcpy(entry->key,key,len+1);
11
12
        entry->value = value;
12
13
        entry->lower = NULL;
13
14
        entry->upper = NULL;
57
58
                return &(entry->value);
58
59
}
59
60
 
60
 
GoomHash *goom_hash_new(void) {
 
61
GoomHash *goom_hash_new() {
61
62
        GoomHash *_this = (GoomHash*)malloc(sizeof(GoomHash));
62
63
        _this->root = NULL;
 
64
  _this->number_of_puts = 0;
63
65
        return _this;
64
66
}
65
67
 
69
71
}
70
72
 
71
73
void goom_hash_put(GoomHash *_this, const char *key, HashValue value) {
 
74
  _this->number_of_puts += 1;
72
75
        if (_this->root == NULL)
73
76
                _this->root = entry_new(key,value);
74
77
        else
98
101
    goom_hash_put(_this,key,value);
99
102
}
100
103
 
101
 
 
 
104
/* FOR EACH */
 
105
 
 
106
static void _goom_hash_for_each(GoomHash *_this, GoomHashEntry *entry, GH_Func func)
 
107
{
 
108
  if (entry == NULL) return;
 
109
  func(_this, entry->key, &(entry->value));
 
110
  _goom_hash_for_each(_this, entry->lower, func);
 
111
  _goom_hash_for_each(_this, entry->upper, func);
 
112
}
 
113
 
 
114
void goom_hash_for_each(GoomHash *_this, GH_Func func) {
 
115
  _goom_hash_for_each(_this, _this->root, func);
 
116
}
 
117
 
 
118
int goom_hash_number_of_puts(GoomHash *_this) {
 
119
  return _this->number_of_puts;
 
120
}