Diff
Not logged in

Differences From Artifact [22c434256e]:

To Artifact [7d9366ce45]:


1797
1798
1799
1800
1801
1802
1803






1804
1805
1806
1807
1808
1809
1810
....
1908
1909
1910
1911
1912
1913
1914





1915
1916
1917
1918
1919
1920
1921
....
3066
3067
3068
3069
3070
3071
3072





3073
3074
3075
3076
3077
3078
3079
....
3225
3226
3227
3228
3229
3230
3231





3232
3233
3234
3235
3236
3237
3238
....
3619
3620
3621
3622
3623
3624
3625





3626
3627
3628
3629
3630
3631
3632
....
3901
3902
3903
3904
3905
3906
3907



3908
3909
3910
3911
3912
3913
3914
		    utf16 = 1;
		if (!utf16)
		  {
		      /* 'stripped' UTF-16: requires padding */
		      unsigned int i;
		      for (i = 0; i < len; i++)
			{






			    *(utf16_buf + (utf16_off * 2) + (i * 2)) =
				*p_string;
			    p_string++;
			    *(utf16_buf + (utf16_off * 2) + ((i * 2) + 1)) =
				0x00;
			}
		  }
................................................................................
		      memcpy (utf16_buf, p_string, available);
		      workbook->shared_strings.current_utf16_off =
			  available / 2;
		  }
		return FREEXL_OK;
	    }






	  if (!parse_unicode_string
	      (workbook->utf16_converter, len, utf16, p_string, &utf8_string))
	      return FREEXL_INVALID_CHARACTER;

	  /* skipping string data */
	  if (!utf16)
	      p_string += len;
................................................................................
		return FREEXL_OK;
	    }

	  memcpy (offset.bytes, workbook->record, 4);
	  if (swap)
	      swap32 (&offset);
	  len = workbook->record[6];





	  if (workbook->biff_version == FREEXL_BIFF_VER_5)
	    {
		/* BIFF5: codepage text */
		memcpy (name, workbook->record + 7, len);
		utf8_name =
		    convert_to_utf8 (workbook->utf8_converter, name, len, &err);
		if (err)
................................................................................
		if (swap)
		    swap16 (&word16);
		len = word16.value;
		p_string = workbook->record + 4;
		get_unicode_params (p_string, swap, &start_offset, &utf16,
				    &extra_skip);
		p_string += start_offset;





		if (!parse_unicode_string
		    (workbook->utf16_converter, len, utf16, p_string,
		     &utf8_string))
		    return FREEXL_INVALID_CHARACTER;
		check_format (utf8_string, &is_date, &is_datetime, &is_time);
		free (utf8_string);
		if (is_date || is_datetime || is_time)
................................................................................
		/* please note: this always is UTF-16 [BIFF8] */
		int utf16 = 0;
		unsigned int start_offset;
		unsigned int extra_skip;
		get_unicode_params (p_string, swap, &start_offset, &utf16,
				    &extra_skip);
		p_string += start_offset;





		if (!parse_unicode_string
		    (workbook->utf16_converter, len, utf16, p_string,
		     &utf8_string))
		    return FREEXL_INVALID_CHARACTER;
	    }
	  ret = set_text_value (workbook, row, col, utf8_string);
	  if (ret != FREEXL_OK)
................................................................................
	  swap16 (&record_type);
	  swap16 (&record_size);
      }
/* saving the current record */
    workbook->record_type = record_type.value;
    workbook->record_size = record_size.value;




    if ((workbook->p_in - workbook->fat->miniStream) + workbook->record_size >
	(int) workbook->size)
	return 0;		/* unexpected EOF */

    memcpy (workbook->record, workbook->p_in, workbook->record_size);
    workbook->p_in += record_size.value;








>
>
>
>
>
>







 







>
>
>
>
>







 







>
>
>
>
>







 







>
>
>
>
>







 







>
>
>
>
>







 







>
>
>







1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
....
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
....
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
....
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
....
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
....
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
		    utf16 = 1;
		if (!utf16)
		  {
		      /* 'stripped' UTF-16: requires padding */
		      unsigned int i;
		      for (i = 0; i < len; i++)
			{
			    if (p_string - workbook->record >=
				workbook->record_size)
			      {
				  /* buffer overflow: it's a preasumable crafted file intended to crash FreeXL */
				  return FREEXL_CRAFTED_FILE;
			      }
			    *(utf16_buf + (utf16_off * 2) + (i * 2)) =
				*p_string;
			    p_string++;
			    *(utf16_buf + (utf16_off * 2) + ((i * 2) + 1)) =
				0x00;
			}
		  }
................................................................................
		      memcpy (utf16_buf, p_string, available);
		      workbook->shared_strings.current_utf16_off =
			  available / 2;
		  }
		return FREEXL_OK;
	    }

	  if (len <= 0)
	    {
		/* zero length - it's a preasumable crafted file intended to crash FreeXL */
		return FREEXL_CRAFTED_FILE;
	    }
	  if (!parse_unicode_string
	      (workbook->utf16_converter, len, utf16, p_string, &utf8_string))
	      return FREEXL_INVALID_CHARACTER;

	  /* skipping string data */
	  if (!utf16)
	      p_string += len;
................................................................................
		return FREEXL_OK;
	    }

	  memcpy (offset.bytes, workbook->record, 4);
	  if (swap)
	      swap32 (&offset);
	  len = workbook->record[6];
	  if (len <= 0)
	    {
		/* zero length - it's a preasumable crafted file intended to crash FreeXL */
		return FREEXL_CRAFTED_FILE;
	    }
	  if (workbook->biff_version == FREEXL_BIFF_VER_5)
	    {
		/* BIFF5: codepage text */
		memcpy (name, workbook->record + 7, len);
		utf8_name =
		    convert_to_utf8 (workbook->utf8_converter, name, len, &err);
		if (err)
................................................................................
		if (swap)
		    swap16 (&word16);
		len = word16.value;
		p_string = workbook->record + 4;
		get_unicode_params (p_string, swap, &start_offset, &utf16,
				    &extra_skip);
		p_string += start_offset;
		if (len <= 0)
		  {
		      /* zero length - it's a preasumable crafted file intended to crash FreeXL */
		      return FREEXL_CRAFTED_FILE;
		  }
		if (!parse_unicode_string
		    (workbook->utf16_converter, len, utf16, p_string,
		     &utf8_string))
		    return FREEXL_INVALID_CHARACTER;
		check_format (utf8_string, &is_date, &is_datetime, &is_time);
		free (utf8_string);
		if (is_date || is_datetime || is_time)
................................................................................
		/* please note: this always is UTF-16 [BIFF8] */
		int utf16 = 0;
		unsigned int start_offset;
		unsigned int extra_skip;
		get_unicode_params (p_string, swap, &start_offset, &utf16,
				    &extra_skip);
		p_string += start_offset;
		if (len <= 0)
		  {
		      /* zero length - it's a preasumable crafted file intended to crash FreeXL */
		      return FREEXL_CRAFTED_FILE;
		  }
		if (!parse_unicode_string
		    (workbook->utf16_converter, len, utf16, p_string,
		     &utf8_string))
		    return FREEXL_INVALID_CHARACTER;
	    }
	  ret = set_text_value (workbook, row, col, utf8_string);
	  if (ret != FREEXL_OK)
................................................................................
	  swap16 (&record_type);
	  swap16 (&record_size);
      }
/* saving the current record */
    workbook->record_type = record_type.value;
    workbook->record_size = record_size.value;

    if (workbook->record_size >= 8192)
	return 0;		/* malformed or crafted file */

    if ((workbook->p_in - workbook->fat->miniStream) + workbook->record_size >
	(int) workbook->size)
	return 0;		/* unexpected EOF */

    memcpy (workbook->record, workbook->p_in, workbook->record_size);
    workbook->p_in += record_size.value;