A covariance matrix relies on the idea that, in the case of two vectors, the observations are paired - each observation in vector $x$ corresponds in some logical manner to an observation in vector $y$ and vice versa. If there's no pairing of elements, you can't construct a covariance matrix.
If there is a pairing of elements, and the vectors are of different lengths, then you have missing data. I'll assume for simplicity of exposition that there's no data missing from the longer vector (i.e., observations in the shorter vector with no corresponding observation in the longer vector.) If the presence or absence of data in the shorter vector is unrelated to the values (in both vectors) that would have been observed if you'd had the full-length vector, then you can form the covariance estimates based on the data you do see. Otherwise, you have a missing data problem, and I'll refer you to the link for more information on that.