Revision 12ad6671 libavformat/wc3movie.c

View differences:

libavformat/wc3movie.c
140 140
    unsigned int fourcc_tag;
141 141
    unsigned int size;
142 142
    AVStream *st;
143
    char buffer[513];
144 143
    int ret = 0;
145 144
    int current_palette = 0;
146
    int bytes_to_read;
145
    char *buffer;
147 146
    int i;
148 147
    unsigned char rotate;
149 148

  
......
185 184

  
186 185
        case BNAM_TAG:
187 186
            /* load up the name */
188
            if ((unsigned)size < 512)
189
                bytes_to_read = size;
190
            else
191
                bytes_to_read = 512;
192
            if ((ret = get_buffer(pb, buffer, bytes_to_read)) != bytes_to_read)
187
            buffer = av_malloc(size+1);
188
            if (!buffer)
189
                return AVERROR_NOMEM;
190
            if ((ret = get_buffer(pb, buffer, size)) != size)
193 191
                return AVERROR(EIO);
194
            buffer[bytes_to_read] = 0;
195
            av_metadata_set(&s->metadata, "title", buffer);
192
            buffer[size] = 0;
193
            av_metadata_set2(&s->metadata, "title", buffer,
194
                                   AV_METADATA_DONT_STRDUP_VAL);
196 195
            break;
197 196

  
198 197
        case SIZE_TAG:

Also available in: Unified diff