diff --git a/src/Processors/Formats/Impl/AvroRowInputFormat.cpp b/src/Processors/Formats/Impl/AvroRowInputFormat.cpp index d683c472899..83d31fa0be8 100644 --- a/src/Processors/Formats/Impl/AvroRowInputFormat.cpp +++ b/src/Processors/Formats/Impl/AvroRowInputFormat.cpp @@ -697,8 +697,15 @@ static uint32_t readConfluentSchemaId(ReadBuffer & in) uint8_t magic; uint32_t schema_id; - readBinaryBigEndian(magic, in); - readBinaryBigEndian(schema_id, in); + try + { + readBinaryBigEndian(magic, in); + readBinaryBigEndian(schema_id, in); + } + catch(Exception & e) { + /* empty or incomplete message without Avro Confluent magic number or schema id */ + throw Exception("Missing AvroConfluent magic byte or schema identifier.", ErrorCodes::INCORRECT_DATA); + } if (magic != 0x00) {