<commit_before>package toml

import "bytes"

func FuzzToml(data []byte) int {
	buf := make([]byte, 0, 2048)

	var m interface{}
	_, err := Decode(string(data), &m)
	if err != nil {
		return 0
	}

	err = NewEncoder(bytes.NewBuffer(buf)).Encode(m)
	if err != nil {
		return 0
	}

	return 1
}
<commit_msg>burntsushi-toml: Fixes out-of-memory crash (#8297)<commit_after>package toml

import "bytes"

func FuzzToml(data []byte) int {

	if len(data) >= 10240 {
		return 0
	}

	buf := make([]byte, 0, 2048)

	var m interface{}
	_, err := Decode(string(data), &m)
	if err != nil {
		return 0
	}

	err = NewEncoder(bytes.NewBuffer(buf)).Encode(m)
	if err != nil {
		return 0
	}

	return 1
}

{'fraction_non_alphanumeric': 0.15689149560117302, 'fraction_numerical': 0.03812316715542522, 'mean_word_length': 3.5533333333333332, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7369380', 'n_tokens_mistral': 310, 'n_tokens_neox': 271, 'n_words': 73}