Index: branches/BNC_2.12/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- branches/BNC_2.12/src/RTCM3/RTCM3Decoder.cpp	(revision 9089)
+++ branches/BNC_2.12/src/RTCM3/RTCM3Decoder.cpp	(revision 9193)
@@ -1039,5 +1039,4 @@
     GETFLOATSIGN(eph._clock_drift,    16, 1.0 / (double )(1 << 30) / (double )(1 << 13))
     GETFLOATSIGN(eph._clock_bias,     22, 1.0 / (double )(1 << 30) / (double )(1 << 1))
-
     GETBITS(eph._IODC, 10)
     GETFLOATSIGN(eph._Crs, 16, 1.0 / (double )(1 << 5))
@@ -1048,4 +1047,5 @@
     GETFLOATSIGN(eph._Cus, 16, 1.0 / (double )(1 << 29))
     GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
+    if (eph._sqrt_A < 1000.0) {return false;}
     GETBITS(i, 16)
     i <<= 4;
@@ -1102,4 +1102,5 @@
     GETBITS(eph._almanac_health, 1) /* almanac healthy */
     GETBITS(eph._almanac_health_availablility_indicator, 1) /* almanac health ok */
+    if (eph._almanac_health_availablility_indicator == 0.0) {return false;}
     GETBITS(eph._P1, 2) /*  P1 */
     GETBITS(i, 5)
@@ -1109,5 +1110,5 @@
     GETBITS(i, 1)
     tk += i * 30;
-       eph._tki = tk - 3*60*60;
+    eph._tki = tk - 3*60*60;
     if(eph._tki < 0.0) {
       eph._tki += 86400.0;
@@ -1137,6 +1138,8 @@
     GETBITS(eph._M_FT, 4) /* GLONASS-M Ft */
     GETBITS(eph._M_NT, 11) /* GLONASS-M Nt */
+    if (eph._M_NT == 0.0) {return false;}
     GETBITS(eph._M_M, 2) /* GLONASS-M M */
     GETBITS(eph._additional_data_availability, 1) /* GLONASS-M The Availability of Additional Data */
+    if (eph._additional_data_availability == 0.0) {return false;}
     GETBITS(eph._NA, 11) /* GLONASS-M Na */
     GETFLOATSIGNM(eph._tauC, 32, 1.0/(double)(1<<30)/(double)(1<<1)) /* GLONASS tau c */
@@ -1193,5 +1196,4 @@
     GETFLOATSIGN(eph._clock_drift,    16, 1.0 / (double )(1 << 30) / (double )(1 << 13))
     GETFLOATSIGN(eph._clock_bias,     22, 1.0 / (double )(1 << 30) / (double )(1 << 1))
-
     GETBITS(eph._IODE, 8)
     GETFLOATSIGN(eph._Crs, 16, 1.0 / (double )(1 << 5))
@@ -1202,4 +1204,5 @@
     GETFLOATSIGN(eph._Cus, 16, 1.0 / (double )(1 << 29))
     GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
+    if (eph._sqrt_A < 1000.0) {return false;}
     GETBITS(i, 16)
     i <<= 4;
@@ -1310,4 +1313,5 @@
     GETFLOAT(eph._e,            32, 1.0 / (double )(1 << 30) / (double )(1 << 3))
     GETFLOAT(eph._sqrt_A,       32, 1.0 / (double )(1 << 19))
+    if (eph._sqrt_A < 1000.0) {return false;}
     GETFLOATSIGN(eph._OMEGA0,   32, R2R_PI/(double)(1<<30)/(double)(1<< 1))
     GETFLOATSIGN(eph._omega,    32, R2R_PI/(double)(1<<30)/(double)(1<< 1))
@@ -1407,4 +1411,5 @@
     GETFLOATSIGN(eph._Cus, 16, 1.0 / (double )(1 << 29))
     GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
+    if (eph._sqrt_A < 1000.0) {return false;}
     GETBITSFACTOR(eph._TOEsec, 14, 60)
     /* FIXME: overwrite value, copied from old code */
@@ -1423,9 +1428,16 @@
       eph._e5aDataInValid = false;
 
-GETFLOATSIGN(eph._BGD_1_5B, 10, 1.0 / (double )(1 << 30) / (double )(1 << 2))
+      GETFLOATSIGN(eph._BGD_1_5B, 10, 1.0 / (double )(1 << 30) / (double )(1 << 2))
       GETBITS(eph._E5bHS, 2)
       GETBITS(eph._e5bDataInValid, 1)
       GETBITS(eph._E1_bHS, 2)
       GETBITS(eph._e1DataInValid, 1)
+      if (eph._E5bHS != eph._E1_bHS) {
+        return false;
+      }
+      if ((eph._BGD_1_5A == 0.0 && fabs(eph._BGD_1_5B) > 1e-9) ||
+          (eph._BGD_1_5B == 0.0 && fabs(eph._BGD_1_5A) > 1e-9)) {
+        return false;
+      }
     }
     else {
@@ -1487,5 +1499,6 @@
     GETFLOATSIGN(eph._Cus, 18, 1.0 / (double )(1 << 30) / (double )(1 << 1))
     GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19))
-    GETBITS(i, 17)
+	if (eph._sqrt_A < 1000.0) {return false;}
+	GETBITS(i, 17)
     i <<= 3;
     eph._TOEsec = i;
@@ -1679,4 +1692,9 @@
           case 1045:
           case 1046:
+            // reject 1045/1046 from JAXA RTKLIB encoded stations
+            if (_staID.contains("AIRA") || _staID.contains("STK2") ||
+                _staID.contains("CCJ2") || _staID.contains("SYOG")) {
+              break;
+            }
             if (DecodeGalileoEphemeris(_Message, _BlockSize))
               decoded = true;
