@@ -1136,6 +1136,41 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
11361136 break ;
11371137 }
11381138
1139+ // @xyz
1140+ case FOURCC (' \xA9 ' , ' x' , ' y' , ' z' ):
1141+ {
1142+ // Best case the total data length inside "@xyz" box
1143+ // would be 8, for instance "@xyz" + "\x00\x04\x15\xc7" + "0+0/",
1144+ // where "\x00\x04" is the text string length with value = 4,
1145+ // "\0x15\xc7" is the language code = en, and "0+0" is a
1146+ // location (string) value with longitude = 0 and latitude = 0.
1147+ if (chunk_data_size < 8 ) {
1148+ return ERROR_MALFORMED;
1149+ }
1150+
1151+ // Worst case the location string length would be 18,
1152+ // for instance +90.0000-180.0000, without the trailing "/" and
1153+ // the string length + language code.
1154+ char buffer[18 ];
1155+
1156+ // Substracting 5 from the data size is because the text string length +
1157+ // language code takes 4 bytes, and the trailing slash "/" takes 1 byte.
1158+ off64_t location_length = chunk_data_size - 5 ;
1159+ if (location_length >= (off64_t ) sizeof (buffer)) {
1160+ return ERROR_MALFORMED;
1161+ }
1162+
1163+ if (mDataSource ->readAt (
1164+ data_offset + 4 , buffer, location_length) < location_length) {
1165+ return ERROR_IO;
1166+ }
1167+
1168+ buffer[location_length] = ' \0 ' ;
1169+ mFileMetaData ->setCString (kKeyLocation , buffer);
1170+ *offset += chunk_size;
1171+ break ;
1172+ }
1173+
11391174 case FOURCC (' e' , ' s' , ' d' , ' s' ):
11401175 {
11411176 if (chunk_data_size < 4 ) {
0 commit comments