Lines 1-8
Link Here
|
1 |
|
1 |
|
2 |
/* pngrutil.c - utilities to read a PNG file |
2 |
/* pngrutil.c - utilities to read a PNG file |
3 |
* |
3 |
* |
4 |
* Last changed in libpng 1.2.31 [August 19, 2008] |
4 |
* Last changed in libpng 1.2.33 [October 23, 2008] |
5 |
* For conditions of distribution and use, see copyright notice in png.h |
5 |
* For conditions of distribution and use, see copyright notice in png.h |
6 |
* Copyright (c) 1998-2008 Glenn Randers-Pehrson |
6 |
* Copyright (c) 1998-2008 Glenn Randers-Pehrson |
7 |
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
7 |
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
8 |
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
8 |
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
Lines 1939-1961
Link Here
|
1939 |
length = (png_uint_32)65535L; |
1939 |
length = (png_uint_32)65535L; |
1940 |
} |
1940 |
} |
1941 |
#endif |
1941 |
#endif |
1942 |
|
1942 |
|
1943 |
key = (png_charp)png_malloc_warn(png_ptr, length + 1); |
1943 |
png_free(png_ptr,png_ptr->chunkdata); |
1944 |
if (key == NULL) |
1944 |
png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); |
|
|
1945 |
if (png_ptr->chunkdata == NULL) |
1945 |
{ |
1946 |
{ |
1946 |
png_warning(png_ptr, "No memory to process text chunk."); |
1947 |
png_warning(png_ptr, "No memory to process text chunk."); |
1947 |
return; |
1948 |
return; |
1948 |
} |
1949 |
} |
1949 |
slength = (png_size_t)length; |
1950 |
slength = (png_size_t)length; |
1950 |
png_crc_read(png_ptr, (png_bytep)key, slength); |
1951 |
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); |
1951 |
|
1952 |
|
1952 |
if (png_crc_finish(png_ptr, skip)) |
1953 |
if (png_crc_finish(png_ptr, skip)) |
1953 |
{ |
1954 |
{ |
1954 |
png_free(png_ptr, key); |
1955 |
png_free(png_ptr, png_ptr->chunkdata); |
|
|
1956 |
png_ptr->chunkdata = NULL; |
1955 |
return; |
1957 |
return; |
1956 |
} |
1958 |
} |
1957 |
|
1959 |
|
|
|
1960 |
key = png_ptr->chunkdata; |
1958 |
key[slength] = 0x00; |
1961 |
key[slength] = 0x00; |
1959 |
|
1962 |
|
1960 |
for (text = key; *text; text++) |
1963 |
for (text = key; *text; text++) |
1961 |
/* empty loop to find end of key */ ; |
1964 |
/* empty loop to find end of key */ ; |
Lines 1967-1975
Link Here
|
1967 |
(png_uint_32)png_sizeof(png_text)); |
1970 |
(png_uint_32)png_sizeof(png_text)); |
1968 |
if (text_ptr == NULL) |
1971 |
if (text_ptr == NULL) |
1969 |
{ |
1972 |
{ |
1970 |
png_warning(png_ptr, "Not enough memory to process text chunk."); |
1973 |
png_warning(png_ptr, "Not enough memory to process text chunk."); |
1971 |
png_free(png_ptr, key); |
1974 |
png_free(png_ptr, png_ptr->chunkdata); |
|
|
1975 |
png_ptr->chunkdata = NULL; |
1972 |
return; |
1976 |
return; |
1973 |
} |
1977 |
} |
1974 |
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; |
1978 |
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; |
1975 |
text_ptr->key = key; |
1979 |
text_ptr->key = key; |
Lines 1982-1990
Link Here
|
1982 |
text_ptr->text_length = png_strlen(text); |
1986 |
text_ptr->text_length = png_strlen(text); |
1983 |
|
1987 |
|
1984 |
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); |
1988 |
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); |
1985 |
|
1989 |
|
1986 |
png_free(png_ptr, key); |
1990 |
png_free(png_ptr, png_ptr->chunkdata); |
|
|
1991 |
png_ptr->chunkdata = NULL; |
1987 |
png_free(png_ptr, text_ptr); |
1992 |
png_free(png_ptr, text_ptr); |
1988 |
if (ret) |
1993 |
if (ret) |
1989 |
png_warning(png_ptr, "Insufficient memory to process text chunk."); |
1994 |
png_warning(png_ptr, "Insufficient memory to process text chunk."); |
1990 |
} |
1995 |
} |